aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/SocialIcons.astro
blob: 5f573fc23254edeac2a8b6c1f7c2806e3b348073 (plain) (blame)
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
35
36
37
38
39
---
import Link from '@/components/Link.astro'
import { buttonVariants } from '@/components/ui/button'
import { ICON_MAP } from '@/consts'
import { cn } from '@/lib/utils'
import type { SocialLink } from '@/types'
import { Icon } from 'astro-icon/components'

interface Props {
  links: SocialLink[]
  class?: string
}

const { links, class: classNames } = Astro.props
---

<ul class={cn('flex flex-wrap gap-2', classNames)} role="list">
  {
    links.map(({ href, label }) => (
      <li>
        <Link
          href={href}
          aria-label={label}
          title={label}
          class={buttonVariants({ variant: 'outline', size: 'icon' })}
          external
        >
          <Icon
            name={
              ICON_MAP[label as keyof typeof ICON_MAP] ||
              'lucide:message-circle-question'
            }
            class="size-4"
          />
        </Link>
      </li>
    ))
  }
</ul>