tailwind-nextjs-blog/components/Tag.tsx

18 lines
394 B
TypeScript
Raw Normal View History

2023-08-16 23:55:57 +08:00
import Link from 'next/link';
import { slug } from 'github-slugger';
interface Props {
2023-08-16 23:55:57 +08:00
text: string;
}
const Tag = ({ text }: Props) => {
2022-07-17 21:40:41 +08:00
return (
<Link
href={`/tags/${slug(text)}`}
2023-08-16 23:55:57 +08:00
className="mr-3 text-sm font-medium uppercase text-primary-500 hover:text-primary-600 dark:hover:text-primary-400">
{text.split(' ').join('-')}
2022-07-17 21:40:41 +08:00
</Link>
2023-08-16 23:55:57 +08:00
);
};
2022-07-17 21:40:41 +08:00
2023-08-16 23:55:57 +08:00
export default Tag;