import { githubSvg } from '../../internal/svg/githubSvg'; import { twitterSvg } from '../../internal/svg/twitterSvg'; import { warpcastSvg } from '../../internal/svg/warpcastSvg'; import { websiteSvg } from '../../internal/svg/websiteSvg'; import { cn, pressable } from '../../styles/theme'; export type SocialPlatform = 'twitter' | 'github' | 'farcaster' | 'website'; export const PLATFORM_CONFIG: Record< SocialPlatform, { href: (value: string) => string; icon: React.ReactNode; ariaLabel: (value: string) => string; } > = { twitter: { href: (value) => `https://x.com/${value}`, icon: twitterSvg, ariaLabel: (value) => `Visit ${value} on X (formerly Twitter)`, }, github: { href: (value) => `https://github.com/${value}`, icon: githubSvg, ariaLabel: (value) => `Visit ${value} on GitHub`, }, farcaster: { href: (value) => { const username = value.split('/').pop(); return `https://warpcast.com/${username}`; }, icon: warpcastSvg, ariaLabel: (value) => { const username = value.split('/').pop(); return `Visit ${username} on Farcaster (Warpcast)`; }, }, website: { href: (value) => value, icon: websiteSvg, ariaLabel: (value) => `Visit ${value}`, }, }; export function SocialPlatformDetails({ platform, value, }: { platform: SocialPlatform; value: string; }) { const config = PLATFORM_CONFIG[platform]; const ariaLabel = config.ariaLabel(value); return ( {platform}
{config.icon}
); }