@ -0,0 +1,55 @@ |
||||
.card { |
||||
display: flex; |
||||
box-sizing: border-box; |
||||
max-width: 540px; |
||||
padding: 1.5rem; |
||||
border-radius: 4px; |
||||
background-color: white; |
||||
} |
||||
|
||||
.poster { |
||||
width: 150px; |
||||
height: 150px; |
||||
margin-right: 1.25rem; |
||||
} |
||||
|
||||
.details { |
||||
position: relative; |
||||
} |
||||
|
||||
.name { |
||||
color: var(--purple-2); |
||||
font-weight: bolder; |
||||
font-size: 1.125rem; |
||||
line-height: 1.6875rem; |
||||
margin: 0; |
||||
} |
||||
|
||||
.desc { |
||||
color: var(--purple-2); |
||||
font-size: 0.75rem; |
||||
} |
||||
|
||||
.spacer { |
||||
height: 35px; |
||||
} |
||||
|
||||
.button { |
||||
position: absolute; |
||||
bottom: 0; |
||||
left: 0; |
||||
} |
||||
|
||||
.logo { |
||||
width: 30px; |
||||
position: absolute; |
||||
bottom: 0; |
||||
right: 0; |
||||
} |
||||
|
||||
@media only screen and (max-width: 768px) { |
||||
.card { |
||||
padding: 0; |
||||
background-color: #e1eefa; |
||||
} |
||||
} |
@ -0,0 +1,74 @@ |
||||
import React, { ReactNode } from "react"; |
||||
// import { Button } from "./Button";
|
||||
import { EventSetting } from "./EventSetting"; |
||||
import styles from "./EventDescriptionCard.module.css"; |
||||
|
||||
interface BaseProps { |
||||
name: string; |
||||
date: Date; |
||||
poster: string; |
||||
registerLink?: string; |
||||
children: ReactNode; |
||||
} |
||||
|
||||
type Props = BaseProps & |
||||
( |
||||
| { online: true; location: keyof typeof links } |
||||
| { online: false; location: string } |
||||
); |
||||
|
||||
const links = { |
||||
Twitch: "https://www.twitch.tv/uwcsclub", |
||||
Discord: "https://discord.gg/pHfYBCg", |
||||
Facebook: "https://www.facebook.com/uw.computerscienceclub", |
||||
Instagram: "https://www.instagram.com/uwcsclub/", |
||||
}; |
||||
|
||||
/** |
||||
* @remarks |
||||
* - Child elements will display as the event's description |
||||
* - Assuming date prop is in EST |
||||
* - poster is the event's image name, including file ending (.jpg/.png/etc) |
||||
* - If event is online, location will be the platform, with capital first letter and no trailing spaces |
||||
* - ie. location="Discord" |
||||
* @todo |
||||
* get Link component |
||||
*/ |
||||
export function EventDescriptionCard(props: Props) { |
||||
return ( |
||||
<article className={styles.card}> |
||||
<img className={styles.poster} src={props.poster} alt={props.name} /> |
||||
|
||||
<div className={styles.details}> |
||||
<h3 className={styles.name}>{props.name}</h3> |
||||
|
||||
<EventSetting |
||||
date={props.date} |
||||
online={props.online} |
||||
location={props.location} |
||||
/> |
||||
<div className={styles.desc}>{props.children}</div> |
||||
<div className={styles.spacer}></div> |
||||
|
||||
<footer> |
||||
{props.registerLink && ( |
||||
<div className={styles.button}> |
||||
<button> |
||||
<a href={props.registerLink}>Register</a> |
||||
</button> |
||||
</div> |
||||
)} |
||||
{props.online && ( |
||||
<a target="_blank" href={links[props.location]} rel="noreferrer"> |
||||
<img |
||||
className={styles.logo} |
||||
alt={props.location} |
||||
src={"logos/" + props.location + ".png"} |
||||
/> |
||||
</a> |
||||
)} |
||||
</footer> |
||||
</div> |
||||
</article> |
||||
); |
||||
} |
@ -0,0 +1,5 @@ |
||||
.setting { |
||||
color: var(--blue-1); |
||||
font-weight: bolder; |
||||
font-size: 0.75rem; |
||||
} |
@ -0,0 +1,28 @@ |
||||
import React from "react"; |
||||
import styles from "./EventSetting.module.css"; |
||||
|
||||
interface Props { |
||||
date: Date; |
||||
online: boolean; |
||||
location: string; |
||||
} |
||||
|
||||
export function EventSetting(props: Props) { |
||||
const date = props.date.toLocaleDateString("en-US", { |
||||
day: "numeric", |
||||
month: "long", |
||||
year: "numeric", |
||||
}); |
||||
const time = props.date.toLocaleTimeString("en-US", { |
||||
hour: "numeric", |
||||
minute: "numeric", |
||||
}); |
||||
const location = props.online ? `Online - ${props.location}` : props.location; |
||||
|
||||
return ( |
||||
<div className={styles.setting}> |
||||
<time dateTime={props.date.toISOString()}>{`${date} | ${time}`}</time> |
||||
{` | ${location}`} |
||||
</div> |
||||
); |
||||
} |
After Width: | Height: | Size: 268 KiB |
After Width: | Height: | Size: 321 KiB |
Before Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 900 B |
After Width: | Height: | Size: 615 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 575 B |