tailwind-nextjs-blog/components/Tag.tsx

19 lines
393 B
TypeScript
Raw Normal View History

2023-08-16 23:28:02 +08:00
import Link from 'next/link'
import { slug } from 'github-slugger'
interface Props {
2023-08-16 23:28:02 +08:00
text: string
}
const Tag = ({ text }: Props) => {
2022-07-17 21:40:41 +08:00
return (
2023-08-16 23:28:02 +08:00
<Link
href={`/tags/${slug(text)}`}
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:28:02 +08:00
)
}
2022-07-17 21:40:41 +08:00
2023-08-16 23:28:02 +08:00
export default Tag