Merge remote-tracking branch 'origin/main' into feat/organized-content

This commit is contained in:
Aditya Thakral 2021-06-09 21:08:39 -04:00
commit d0437106b8
19 changed files with 216 additions and 36 deletions

View File

@ -10,6 +10,9 @@ stages:
- build - build
- staging - staging
variables:
NEXT_PUBLIC_BASE_PATH: '/~a3thakra/csc'
install_deps: install_deps:
stage: .pre stage: .pre
script: script:
@ -25,14 +28,22 @@ build:
script: script:
- npm run build - npm run build
pages: staging:
stage: staging stage: staging
script: script:
- npm run export - npm run export
- mv public src-public
- mv out public
artifacts: artifacts:
paths: paths:
- public - out
only: only:
- main refs:
- main
deploy_staging:
stage: .post
needs: ["staging"]
script:
- 'curl -XPOST -H "Authorization: Basic $STAGING_SECRET" "https://csclub.uwaterloo.ca/~a3thakra/csc/"'
only:
refs:
- main

View File

@ -0,0 +1,32 @@
.button,
.link {
font-family: "Poppins", "sans-serif";
border-radius: calc(20rem / 16);
background-color: var(--blue-2);
color: white;
border: none;
outline: none;
transition-duration: 0.3s;
font-weight: normal;
text-align: center;
}
.button:hover,
.link:hover {
background-color: var(--teal-2);
cursor: pointer;
}
.link {
text-decoration: none;
}
.small {
padding: calc(5rem / 16) calc(30rem / 16);
font-size: calc(14rem / 16);
}
.normal {
padding: calc(10rem / 16) calc(50rem / 16);
font-size: calc(18rem / 16);
}

40
components/Button.tsx Normal file
View File

@ -0,0 +1,40 @@
import React, { AnchorHTMLAttributes, ButtonHTMLAttributes } from "react";
import styles from "./Button.module.css";
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
isLink?: false;
}
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
isLink: true;
}
type Props = (ButtonProps | LinkProps) & { size?: "small" | "normal" };
export function Button(props: Props) {
const btnSize = props.size ? props.size : "normal";
if (props.isLink) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { size, isLink, ...otherProps } = props;
return (
<a
{...otherProps}
target="_blank"
className={`${styles.link} ${styles[btnSize]} ${
otherProps.className ?? ""
}`}
/>
);
} else {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { size, isLink, ...otherProps } = props;
return (
<button
{...otherProps}
className={`${styles.button} ${styles[btnSize]} ${
otherProps.className ?? ""
}`}
/>
);
}
}

View File

@ -21,7 +21,8 @@
} }
.registerButton { .registerButton {
width: 100%; display: block;
font-weight: bold;
} }
.content > h1 { .content > h1 {

View File

@ -1,4 +1,5 @@
import React, { ReactNode } from "react"; import React, { ReactNode } from "react";
import { Button } from "./Button";
import styles from "./EventCard.module.css"; import styles from "./EventCard.module.css";
import { EventSetting } from "./EventSetting"; import { EventSetting } from "./EventSetting";
@ -29,11 +30,15 @@ export function EventCard({
<aside> <aside>
{poster && <Image alt={name} src={poster} />} {poster && <Image alt={name} src={poster} />}
{!poster && <div className={styles.spacer}></div>} {!poster && <div className={styles.spacer}></div>}
{/* TODO: use the <Button /> component */}
{registerLink && ( {registerLink && (
<button className={styles.registerButton}> <Button
<a href={registerLink}>Register</a> isLink={true}
</button> href={registerLink}
size="small"
className={styles.registerButton}
>
Register
</Button>
)} )}
</aside> </aside>
<section className={styles.content}> <section className={styles.content}>

View File

@ -3,7 +3,7 @@
box-sizing: border-box; box-sizing: border-box;
max-width: calc(540rem / 16); max-width: calc(540rem / 16);
padding: calc(24rem / 16); padding: calc(24rem / 16);
border-radius: calc(4rem / 16); border-radius: calc(20rem / 16);
background-color: white; background-color: white;
} }
@ -22,7 +22,7 @@
color: var(--purple-2); color: var(--purple-2);
font-weight: bolder; font-weight: bolder;
font-size: calc(18rem / 16); font-size: calc(18rem / 16);
line-height: calc(27rem / 16); line-height: calc(27 / 18);
margin: 0; margin: 0;
} }
@ -42,7 +42,7 @@
} }
.logo { .logo {
width: calc(30rem / 16); width: calc(32rem / 16);
position: absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: 0;
@ -50,7 +50,7 @@
.setting { .setting {
margin: 0; margin: 0;
color: var(--blue-1); color: var(--blue-2);
font-weight: bolder; font-weight: bolder;
font-size: calc(14rem / 16); font-size: calc(14rem / 16);
} }
@ -58,6 +58,34 @@
@media only screen and (max-width: calc(768rem / 16)) { @media only screen and (max-width: calc(768rem / 16)) {
.card { .card {
padding: 0; padding: 0;
background-color: #e1eefa; background-color: transparent;
}
.details {
min-width: calc(150rem / 16);
}
.name,
.setting {
font-size: calc(14rem / 16);
line-height: calc(21 / 14);
}
.poster {
width: calc(95rem / 16);
height: calc(95rem / 16);
border: 1px solid var(--purple-2);
box-sizing: border-box;
margin-right: calc(14rem / 16);
}
.desc {
font-size: calc(12rem / 16);
line-height: calc(18 / 12);
}
.logo,
.button {
display: none;
} }
} }

View File

@ -1,5 +1,5 @@
import React, { ReactNode } from "react"; import React, { ReactNode } from "react";
// import { Button } from "./Button"; import { Button } from "./Button";
import { Image } from "./Image"; import { Image } from "./Image";
import { EventSetting } from "./EventSetting"; import { EventSetting } from "./EventSetting";
import styles from "./EventDescriptionCard.module.css"; import styles from "./EventDescriptionCard.module.css";
@ -65,9 +65,9 @@ export function EventDescriptionCard({
<footer> <footer>
{registerLink && ( {registerLink && (
<div className={styles.button}> <div className={styles.button}>
<button> <Button isLink={true} href={registerLink} size="small">
<a href={registerLink}>Register</a> Register
</button> </Button>
</div> </div>
)} )}
{online && platformURL && ( {online && platformURL && (

View File

@ -0,0 +1,9 @@
@media only screen and (max-width: calc(768rem / 16)) {
.separator {
display: none;
}
.setting {
display: block;
}
}

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import styles from "./EventSetting.module.css";
interface Props { interface Props {
date: Date; date: Date;
@ -15,13 +16,20 @@ export function EventSetting(props: Props) {
const time = props.date.toLocaleTimeString("en-US", { const time = props.date.toLocaleTimeString("en-US", {
hour: "numeric", hour: "numeric",
minute: "numeric", minute: "numeric",
timeZoneName: "short",
}); });
const location = props.online ? `Online - ${props.location}` : props.location; const location = props.online ? `Online - ${props.location}` : props.location;
const separator = <span className={styles.separator}> | </span>;
return ( return (
<div> <div>
<time dateTime={props.date.toISOString()}>{`${date} | ${time}`}</time> <time className={styles.setting} dateTime={props.date.toISOString()}>
{` | ${location}`} {date}
</time>
{separator}
<span className={styles.setting}>{time}</span>
{separator}
{location}
</div> </div>
); );
} }

View File

@ -3,7 +3,7 @@ import React, { ImgHTMLAttributes } from "react";
export function Image(props: ImgHTMLAttributes<HTMLImageElement>) { export function Image(props: ImgHTMLAttributes<HTMLImageElement>) {
const { src: relativeSrc = "" } = props; const { src: relativeSrc = "" } = props;
let absoluteSrc = process.env.BASE_PATH ?? "/"; let absoluteSrc = process.env.NEXT_PUBLIC_BASE_PATH ?? "/";
if (absoluteSrc.endsWith("/") && relativeSrc.startsWith("/")) { if (absoluteSrc.endsWith("/") && relativeSrc.startsWith("/")) {
absoluteSrc += relativeSrc.slice(1); absoluteSrc += relativeSrc.slice(1);
} else if (absoluteSrc.endsWith("/") || relativeSrc.startsWith("/")) { } else if (absoluteSrc.endsWith("/") || relativeSrc.startsWith("/")) {

View File

@ -8,19 +8,19 @@
color: var(--purple-2); color: var(--purple-2);
font-size: calc(18rem / 16); font-size: calc(18rem / 16);
font-weight: bold; font-weight: bold;
line-height: calc(27rem / 16); line-height: calc(27 / 18);
} }
.author { .author {
color: var(--purple-1); color: var(--purple-1);
font-style: normal; font-style: normal;
line-height: calc(21rem / 16); line-height: calc(21 / 16);
font-size: calc(14rem / 16); font-size: calc(14rem / 16);
margin: calc(5rem / 16) 0 calc(7rem / 16) 0; margin: calc(5rem / 16) 0 calc(7rem / 16) 0;
} }
.content { .content {
line-height: calc(21rem / 16); line-height: calc(21 / 16);
color: var(--purple-2); color: var(--purple-2);
} }

View File

@ -13,7 +13,7 @@
font-weight: bold; font-weight: bold;
color: var(--purple-2); color: var(--purple-2);
font-size: calc(24rem / 16); font-size: calc(24rem / 16);
line-height: calc(36rem / 16); line-height: calc(36 / 24);
margin-bottom: calc(14rem / 16); margin-bottom: calc(14rem / 16);
} }
@ -21,7 +21,7 @@
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
font-size: calc(14rem / 16); font-size: calc(14rem / 16);
line-height: calc(21rem / 16); line-height: calc(21 / 14);
white-space: pre-line; white-space: pre-line;
color: var(--purple-2); color: var(--purple-2);
vertical-align: baseline; vertical-align: baseline;
@ -62,7 +62,7 @@
color: var(--purple-2); color: var(--purple-2);
font-weight: 600; font-weight: 600;
font-size: calc(24rem / 16); font-size: calc(24rem / 16);
line-height: calc(36rem / 16); line-height: calc(36 / 24);
} }
.teamMemberDemo > hr { .teamMemberDemo > hr {
@ -84,7 +84,7 @@
@media only screen and (max-width: calc(768rem / 16)) { @media only screen and (max-width: calc(768rem / 16)) {
.newsDemo, .newsDemo,
.eventDescriptionCardDemo { .eventDescriptionCardDemo {
background-color: #e1eefa; background-color: var(--off-white);
} }
.eventDescriptionCardDemo > * { .eventDescriptionCardDemo > * {

View File

@ -45,6 +45,7 @@ import { EventDescriptionCard } from "./EventDescriptionCard";
import { TeamMember } from "./TeamMember"; import { TeamMember } from "./TeamMember";
import { TeamMemberCard } from "./TeamMemberCard"; import { TeamMemberCard } from "./TeamMemberCard";
import { OrganizedContent, LinkProps } from "./OrganizedContent"; import { OrganizedContent, LinkProps } from "./OrganizedContent";
import { Button } from "./Button";
const events = [ const events = [
{ Content: OOTBReact, metadata: OOTBReactEventMetadata }, { Content: OOTBReact, metadata: OOTBReactEventMetadata },
@ -95,6 +96,31 @@ export function NewsCardDemo() {
); );
} }
export function ButtonDemo() {
return (
<>
<h3>Standard buttons</h3>
<p>
<Button isLink={true} href="/">
Link
</Button>
</p>
<p>
<Button>Button</Button>
</p>
<h3>Small buttons</h3>
<p>
<Button isLink={true} href="/" size="small">
Small Link
</Button>
</p>
<p>
<Button size="small">Small Button</Button>
</p>
</>
);
}
export function EventDescriptionCardDemo() { export function EventDescriptionCardDemo() {
return ( return (
<div className={styles.eventDescriptionCardDemo}> <div className={styles.eventDescriptionCardDemo}>

View File

@ -1,7 +1,7 @@
export const metadata = { export const metadata = {
name: "Afterhours: Personal Relationships", name: "Afterhours: Personal Relationships",
short: "Learn how React works and make your own version!", short: "Learn how React works and make your own version!",
date: new Date("2021-03-02 2:00 PM"), date: new Date("2021-03-02 2:00 PM GMT-4"),
online: false, online: false,
location: "MC", location: "MC",
registerLink: "http://csclub.uwaterloo.ca/", registerLink: "http://csclub.uwaterloo.ca/",

View File

@ -1,7 +1,7 @@
export const metadata = { export const metadata = {
name: "Alt-Tab", name: "Alt-Tab",
short: "CSC is proud to present to you Alt-Tab!", short: "CSC is proud to present to you Alt-Tab!",
date: new Date("March 25, 2021 19:00:00"), date: new Date("March 25, 2021 19:00:00 GMT-4"),
online: true, online: true,
location: "Twitch", location: "Twitch",
poster: "/images/playground/alt-tab.jpg", poster: "/images/playground/alt-tab.jpg",

View File

@ -1,7 +1,7 @@
export const metadata = { export const metadata = {
name: "Out of the Box: React", name: "Out of the Box: React",
short: "Out of the Box is a series of code-along projects that explore what's under the hood of modern web frameworks.", short: "Out of the Box is a series of code-along projects that explore what's under the hood of modern web frameworks.",
date: new Date("March 23, 2021 19:00:00"), date: new Date("March 23, 2021 19:00:00 GMT-4"),
online: true, online: true,
location: "Twitch", location: "Twitch",
poster: "/images/playground/intro-ootb.jpg", poster: "/images/playground/intro-ootb.jpg",

View File

@ -5,5 +5,5 @@ const withMDX = require("@next/mdx")({
module.exports = withMDX({ module.exports = withMDX({
pageExtensions: ["ts", "tsx", "mdx"], pageExtensions: ["ts", "tsx", "mdx"],
trailingSlash: true, trailingSlash: true,
basePath: process.env.BASE_PATH, basePath: process.env.NEXT_PUBLIC_BASE_PATH,
}); });

View File

@ -1,15 +1,26 @@
import React from "react"; import React, { AnchorHTMLAttributes } from "react";
import { AppProps } from "next/app"; import { AppProps } from "next/app";
import { MDXProvider } from "@mdx-js/react"; import { MDXProvider } from "@mdx-js/react";
import { ThemeProvider } from "../components/theme"; import { ThemeProvider } from "../components/theme";
import { Navbar } from "../components/Navbar"; import { Navbar } from "../components/Navbar";
import NextLink from "next/link";
import "./_app.css"; import "./_app.css";
import "./font.css"; import "./font.css";
function Link(props: AnchorHTMLAttributes<HTMLAnchorElement>) {
const { href, ...other } = props;
return (
<NextLink href={href ?? "#"}>
<a {...other}></a>
</NextLink>
);
}
export default function App({ Component, pageProps }: AppProps): JSX.Element { export default function App({ Component, pageProps }: AppProps): JSX.Element {
return ( return (
<ThemeProvider theme="light"> <ThemeProvider theme="light">
<MDXProvider components={{}}> <MDXProvider components={{ a: Link }}>
<Navbar /> <Navbar />
<Component {...pageProps} /> <Component {...pageProps} />
</MDXProvider> </MDXProvider>

View File

@ -6,6 +6,7 @@ import {
TeamMemberDemo, TeamMemberDemo,
TeamMemberCardDemo, TeamMemberCardDemo,
OrganizedContentDemo, OrganizedContentDemo,
ButtonDemo,
} from "../components/playground"; } from "../components/playground";
import { TeamMemberCard } from "../components/TeamMemberCard"; import { TeamMemberCard } from "../components/TeamMemberCard";
@ -37,6 +38,14 @@ unavailable
--- ---
## `<Button />`
The `<Button />` is customizable in size and in whether it is an anchor tag or a button tag.
<ButtonDemo />
---
## `<EventDescriptionCard />` ## `<EventDescriptionCard />`
The `<EventDescriptionCard />` component is used on the home page, and uses the The `<EventDescriptionCard />` component is used on the home page, and uses the
@ -57,7 +66,7 @@ The `<EventCard />` component is used on the events page, and uses the
## `<TeamMember />` ## `<TeamMember />`
The `<TeamMember />` component has an image of the team member along with their name and role. The `<TeamMember />` component has an image of the team member along with their name and role.
It is used on the Meet the Team page for non executive members. It is used on the Meet the Team page for non executive members.
<TeamMemberDemo /> <TeamMemberDemo />