summaryrefslogtreecommitdiff
path: root/src/components/tags/tag-card.tsx
blob: 447c73e8cfa1ee5c5640e16d75998b61ba8d88c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Icons } from '@/components/icons/icons';
import { cn } from '@/lib/utils';
import Link from 'next/link';

export const TagCard = ({
  name,
  displayCount = false,
  count,
  className = '',
}: {
  name: string;
  displayCount?: boolean;
  count?: number;
  className?: string;
}) => {
  return (
    <Link
      href={`/tags/${name}`}
      className={cn(
        'group inline-flex items-center gap-2 rounded-lg bg-card/50 px-3 py-2 text-sm transition-colors hover:bg-card/80',
        className,
      )}
    >
      <Icons.tag
        size={18}
        className='my-auto text-muted-foreground transition-transform group-hover:rotate-12'
      />
      <span className='text-card-foreground'>{name}</span>
      {displayCount && count !== undefined && (
        <span className='ml-auto text-muted-foreground'>({count})</span>
      )}
    </Link>
  );
};