Files
DefectingCat 5e6efb9976 Update search box
* add forward ref
* add get posts API
* Add search loading card
* Search page done
* Update build script
2022-02-09 17:59:33 +08:00

32 lines
863 B
TypeScript

import { FC } from 'react';
import dynamic from 'next/dynamic';
import { SearchType } from 'lib/API/types';
import cn from 'classnames';
const Link = dynamic(() => import('components/PathLink'));
const SearchCard: FC<SearchType['result'][0]> = ({ id, title, desc, url }) => {
return (
<>
<Link href={`/p/${url}`} className="block mb-6 last:mb-0">
<article
className={cn(
'rounded-xl overflow-hidden bg-white',
'transition-shadow duration-500',
'md:hover:shadow-lg dark:bg-rua-gray-800',
'p-6'
)}
>
{/* Title */}
<h1 className="text-xl font-semibold">{title}</h1>
{/* Description */}
<p className="py-3 text-gray-600 dark:text-gray-400">{desc}</p>
</article>
</Link>
</>
);
};
export default SearchCard;