Add EventCard

This commit is contained in:
Jared He 2021-05-24 06:00:47 +00:00 committed by Adi Thakral
parent ed9724a36e
commit 429f19fdd4
15 changed files with 180 additions and 16 deletions

2
.gitignore vendored
View File

@ -22,4 +22,4 @@
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*

View File

@ -0,0 +1,43 @@
.card {
display: flex;
flex-direction: row;
max-width: 1000px;
box-sizing: border-box;
padding: 24px;
}
.card aside {
flex: 0 0 144px;
margin-right: 24px;
}
.card aside img {
width: 100%;
margin-bottom: 16px;
}
.registerButton {
width: 100%;
}
.content > h2 {
font-size: 24px;
font-weight: 700;
font-style: normal;
margin-top: 0;
margin-bottom: 0;
}
.content,
.content > h3 {
color: var(--purple-2);
font-size: 14px;
font-weight: 400;
font-style: normal;
margin-top: 0;
margin-bottom: 14px;
}
.content {
margin-bottom: 0;
}

45
components/EventCard.tsx Normal file
View File

@ -0,0 +1,45 @@
import React, { ReactNode } from "react";
import styles from "./EventCard.module.css";
import { EventSetting } from "./EventSetting";
import { Image } from "./Image";
interface EventCardProps {
name: string;
short: string;
date: Date;
online: boolean;
location: string;
poster: string;
registerLink: string;
children: ReactNode;
}
export function EventCard({
name,
date,
online,
location,
poster,
registerLink,
children,
}: EventCardProps) {
return (
<article className={styles.card}>
<aside>
<Image alt={name} src={poster} />
{/* TODO: use the <Button /> component */}
<button className={styles.registerButton}>
<a href={registerLink}>Register</a>
</button>
</aside>
<section className={styles.content}>
<h2>{name}</h2>
<h3>
<EventSetting date={date} online={online} location={location} />
</h3>
<div>{children}</div>
</section>
</article>
);
}

View File

@ -47,6 +47,13 @@
right: 0;
}
.setting {
margin: 0;
color: var(--blue-1);
font-weight: bolder;
font-size: 0.75rem;
}
@media only screen and (max-width: 768px) {
.card {
padding: 0;

View File

@ -42,12 +42,13 @@ export function EventDescriptionCard(props: Props) {
<div className={styles.details}>
<h3 className={styles.name}>{props.name}</h3>
<EventSetting
date={props.date}
online={props.online}
location={props.location}
/>
<h4 className={styles.setting}>
<EventSetting
date={props.date}
online={props.online}
location={props.location}
/>
</h4>
<div className={styles.desc}>{props.children}</div>
<div className={styles.spacer}></div>

View File

@ -1,5 +0,0 @@
.setting {
color: var(--blue-1);
font-weight: bolder;
font-size: 0.75rem;
}

View File

@ -1,5 +1,4 @@
import React from "react";
import styles from "./EventSetting.module.css";
interface Props {
date: Date;
@ -20,7 +19,7 @@ export function EventSetting(props: Props) {
const location = props.online ? `Online - ${props.location}` : props.location;
return (
<div className={styles.setting}>
<div>
<time dateTime={props.date.toISOString()}>{`${date} | ${time}`}</time>
{` | ${location}`}
</div>

View File

@ -5,6 +5,13 @@ import styles from "./playground.module.css";
import AfterHoursContent, {
metadata as afterHoursMetadata,
} from "../content/playground/after-hours.event.mdx";
import OOTBReact, {
metadata as OOTBReactEventMetadata,
} from "../content/playground/ootb-react.event.mdx";
import AltTab, {
metadata as altTabEventMetadata,
} from "../content/playground/alt-tab.event.mdx";
import UnavailableContent, {
metadata as unavailableMetadata,
} from "../content/playground/unavailable.news.mdx";
@ -12,6 +19,7 @@ import { metadata as teamMemberMetadata } from "../content/playground/demo.teamm
import { MiniEventCard } from "./MiniEventCard";
import { NewsCard } from "./NewsCard";
import { EventCard } from "./EventCard";
import { EventDescriptionCard } from "./EventDescriptionCard";
import { TeamMember } from "./TeamMember";
@ -114,6 +122,23 @@ export function EventDescriptionCardDemo() {
);
}
export function EventCardDemo() {
const eventCardData = [
{ Content: OOTBReact, metadata: OOTBReactEventMetadata },
{ Content: AltTab, metadata: altTabEventMetadata },
];
return (
<>
{eventCardData.map(({ Content, metadata }) => (
<EventCard {...metadata} key={metadata.date.toDateString()}>
<Content />
</EventCard>
))}
</>
);
}
export function TeamMemberDemo() {
return (
<div className={styles.teamMemberDemo}>

View File

@ -2,7 +2,10 @@ export const metadata = {
name: "Afterhours: Personal Relationships",
short: "Learn how React works and make your own version!",
date: new Date("2021-03-02 2:00 PM"),
location: "Online - Twitch",
online: false,
location: "MC",
poster: "/images/playground/intro-ootb.jpg",
registerLink: "http://csclub.uwaterloo.ca/",
};
The past year has been tough for all of us, having to deal with the pandemic

View File

@ -0,0 +1,15 @@
export const metadata = {
name: "Alt-Tab",
short: "CSC is proud to present to you Alt-Tab!",
date: new Date("March 25, 2021 19:00:00"),
online: true,
location: "Twitch",
poster: "/images/alt-tab.png",
registerLink: "http://google.com/",
};
CSC is proud to present to you Alt-Tab! Join us in a lightning tech talk series presented to you by our very own students. Alt-Tab consists of 10 to 15-minute talks about anything related to tech. Learn more about exciting topics that range from competitive programming to cryptography!
We will have four incredible presenters that are eager to share their insights with you. Stay tuned as we'll be introducing them and the topics that they will be discussing soon!.
Registration is not required to attend! We'll just be sending you an email reminder, as well as inviting you to our calendar even

View File

@ -0,0 +1,17 @@
export const metadata = {
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.",
date: new Date("March 23, 2021 19:00:00"),
online: true,
location: "Twitch",
poster: "/images/ootb-react.png",
registerLink: "http://google.com/",
};
Modern web frameworks are a black-box. They're easy to use, but they have numerous minute details to master in order to apply them to truly scalable websites. Over the last few years, front-end frameworks have absorbed the responsibilities of the back-end, meaning it's become ever more important to dig their details out of the box.
Out of the Box is a series of code-along projects that explore what's under the hood of modern web frameworks. Nearly 5 million websites use React, including many of the internet's most popular websites. While its simple syntax attracts developers from all over, underneath lies a complex infrastructure of code to manage all elements from caching to hooks. Rishi will bring these ideas to light in our inaugural episode of Out of the Box. Come join him and code your own version of React!
Only basic web experience is needed. All JavaScript code will be written within a single HTML document for simplicity. Node.js will also be required to participate in the event!
Registration is not required to attend! We'll just be sending you an email reminder, as well as inviting you to our calendar event.

3
next-env.d.ts vendored
View File

@ -8,7 +8,10 @@ declare module "*.event.mdx" {
name: string;
short: string;
date: Date;
online: boolean;
location: string;
poster: string;
registerLink: string;
}
const ReactComponent: ComponentType;

View File

@ -2,6 +2,7 @@ import {
MiniEventCardDemo,
NewsCardDemo,
EventDescriptionCardDemo,
EventCardDemo,
TeamMemberDemo
} from "../components/playground";
@ -9,7 +10,7 @@ import {
## `<MiniEventCard />`
The `<MiniEventCard />` component has a collapsible description, and it is used
The `<MiniEventCard />` component has a collapsible description, and it is used
on the events page. It uses the `<details>` tag and works without JS!
<MiniEventCardDemo />
@ -32,6 +33,16 @@ The `<EventDescriptionCard />` component is used on the home page, and uses the
<EventDescriptionCardDemo />
---
## `<EventCard />`
The `<EventCard />` component is used on the events page, and uses the
`<Button />` and `<EventSetting />` components.
<EventCardDemo />
---
## `<TeamMember />`
The `<TeamMember />` component has an image of the team member along with their name and role.

BIN
public/images/alt-tab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB