🏷️ added tags system
This commit is contained in:
36
components/blog/tag-cloud.tsx
Normal file
36
components/blog/tag-cloud.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import Link from 'next/link';
|
||||
import { TagInfo } from '@/lib/tags';
|
||||
|
||||
interface TagCloudProps {
|
||||
tags: Array<TagInfo & { size: 'sm' | 'md' | 'lg' | 'xl' }>;
|
||||
}
|
||||
|
||||
export function TagCloud({ tags }: TagCloudProps) {
|
||||
const sizeClasses = {
|
||||
sm: 'text-xs opacity-70',
|
||||
md: 'text-sm',
|
||||
lg: 'text-base font-bold',
|
||||
xl: 'text-lg font-bold',
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap gap-4 items-baseline">
|
||||
{tags.map(tag => (
|
||||
<Link
|
||||
key={tag.slug}
|
||||
href={`/tags/${tag.slug}`}
|
||||
className={`
|
||||
${sizeClasses[tag.size]}
|
||||
font-mono uppercase
|
||||
text-zinc-400
|
||||
hover:text-cyan-400
|
||||
transition-colors
|
||||
`}
|
||||
title={`${tag.count} ${tag.count === 1 ? 'articol' : 'articole'}`}
|
||||
>
|
||||
#{tag.name}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user