Add fit prop to NewsCard

This commit is contained in:
Aditya Thakral 2021-08-13 04:23:32 -04:00
parent 19617b8bad
commit d7b2d9cf34
2 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,12 @@
border-radius: calc(20rem / 16);
}
.fit.card {
max-width: unset;
padding: unset;
border-radius: unset;
}
.date {
font-size: calc(18rem / 16);
margin: 0;

View File

@ -6,15 +6,19 @@ interface NewsCardProps {
date: Date;
author: string;
children: ReactNode;
fit?: boolean;
}
export const NewsCard: React.FC<NewsCardProps> = ({
date,
author,
children,
fit = false,
}) => {
const classes = fit ? [styles.card, styles.fit] : [styles.card];
return (
<article className={styles.card}>
<article className={classes.join(" ")}>
<h1 className={styles.date}>
<time dateTime={date.toISOString()}>
{date.toLocaleDateString("en-US", {