import { Mail, Github, Facebook, Youtube, Linkedin, Twitter, X, Mastodon, Threads, Instagram, } from './icons' const components = { mail: Mail, github: Github, facebook: Facebook, youtube: Youtube, linkedin: Linkedin, twitter: Twitter, x: X, mastodon: Mastodon, threads: Threads, instagram: Instagram, } type SocialIconProps = { kind: keyof typeof components href: string | undefined size?: number } const SocialIcon = ({ kind, href, size = 8 }: SocialIconProps) => { if ( !href || (kind === 'mail' && !/^mailto:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(href)) ) return null const SocialSvg = components[kind] return ( {kind} ) } export default SocialIcon