mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
* Switch post page to get post with prisma * Switch pagination page to get data from database * Switch search page to get data from database * Add archive card loading
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import { FC } from 'react';
|
|
import cn from 'classnames';
|
|
import dynamic from 'next/dynamic';
|
|
|
|
const DateFormater = dynamic(() => import('components/DateFormater'));
|
|
const Link = dynamic(() => import('components/PathLink'));
|
|
|
|
interface Props {
|
|
post: {
|
|
id: string;
|
|
date: string;
|
|
title: string;
|
|
url: string;
|
|
};
|
|
}
|
|
|
|
const ArchiveCard: FC<Props> = ({ post }) => {
|
|
const { title, url, date } = post;
|
|
|
|
return (
|
|
<>
|
|
<Link
|
|
href={`/p/${url}`}
|
|
className={cn(
|
|
'block',
|
|
'bg-underline bg-bottom bg-no-repeat bg-[length:95%_2px]',
|
|
'duration-300 transition-all',
|
|
'last:bg-none dark:bg-underline-dark dark:last:bg-none',
|
|
'hover:bg-[length:100%_2px]'
|
|
)}
|
|
>
|
|
<div className={cn('p-5')}>
|
|
<h2 className="mb-2 text-lg font-semibold">{title}</h2>
|
|
<DateFormater
|
|
dateString={date}
|
|
className="text-sm text-gray-600 dark:text-gray-400"
|
|
/>
|
|
</div>
|
|
</Link>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default ArchiveCard;
|