import {
DribbbleIcon,
FacebookIcon,
FigmaIcon,
GithubIcon,
GlobeIcon,
InstagramIcon,
LinkIcon,
LinkedinIcon,
SlackIcon,
TwitchIcon,
YoutubeIcon,
} from "lucide-react";
import { brandFor, type BrandKey, type PlatformKey } from "@/lib/social";
import { cn } from "@/lib/utils";
/**
* X's own mark, because lucide's `TwitterIcon` is still the bird.
*
* The label beside it has said X since the rebrand, so the bird was the one
* icon in the app that named a thing that no longer exists. Drawn here rather
* than pulled from an icon pack: one glyph is not worth a dependency.
*/
function XMark({ className }: { className?: string }) {
return (
);
}
const MARKS: Record React.ReactNode> = {
linkedin: LinkedinIcon,
twitter: XMark,
instagram: InstagramIcon,
github: GithubIcon,
youtube: YoutubeIcon,
facebook: FacebookIcon,
twitch: TwitchIcon,
dribbble: DribbbleIcon,
figma: FigmaIcon,
slack: SlackIcon,
website: GlobeIcon,
other: LinkIcon,
};
/**
* The mark for one link.
*
* Takes the raw stored value rather than a platform, because the five named
* columns are not the whole story: everything else a person keeps lives in
* `otherLinks`, where the platform has to be read back off the URL.
*/
export function PlatformIcon({
value,
brand,
className,
}: {
/** A stored link. Ignored when `brand` is given. */
value?: string;
/** The column it is filed under, when the caller knows (a named platform). */
brand?: PlatformKey;
className?: string;
}) {
const Mark = MARKS[brandFor(value ?? "", brand)];
return ;
}