import { Badge, Card, createStyles, Group, Image, rem, Text, UnstyledButton } from "@mantine/core"; import dayjs from "dayjs"; import { useRouter } from "next/router"; import DayJS from "../../lib/dayjs"; const useStyles = createStyles((theme) => ({ card: { position: "relative", backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.white, }, rating: { position: "absolute", top: theme.spacing.xs, right: rem(12), pointerEvents: "none", }, title: { display: "block", marginTop: theme.spacing.md, marginBottom: rem(5), }, action: { backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.colors.gray[0], ...theme.fn.hover({ backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[1], }), }, footer: { marginTop: theme.spacing.md, }, })); interface ArticleCardProps { cover?: string; id: string; title: string; description?: string; author: string; time: Date; } export function ParagraphCard({ className, cover, id, title, description, time, author, ...others }: ArticleCardProps & Omit, keyof ArticleCardProps>) { const router = useRouter(); const { classes, cx } = useStyles(); const linkProps = { href: `/paragraph/${id}` }; return ( {cover && ( )} {title} {description} router.push({ pathname: "/author/[name]", query: { name: author }, }) } > {author} {DayJS.to(dayjs(time))} ); }