forked from www/www-new
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
807 B
35 lines
807 B
import React, { ReactNode } from "react";
|
|
|
|
import styles from "./NewsCard.module.css";
|
|
|
|
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={classes.join(" ")}>
|
|
<h1 className={styles.date}>
|
|
<time dateTime={date.toISOString()}>
|
|
{date.toLocaleDateString("en-US", {
|
|
year: "numeric",
|
|
month: "long",
|
|
day: "numeric",
|
|
})}
|
|
</time>
|
|
</h1>
|
|
<address className={styles.author}>{author}</address>
|
|
<div className={styles.content}>{children}</div>
|
|
</article>
|
|
);
|
|
};
|
|
|