UNPKG

@violetprotocol/nudge-components

Version:

Components for Nudge's websites and applications.

67 lines (66 loc) 2.79 kB
import { jsx, Fragment } from "react/jsx-runtime"; import { IconButton } from "@material-tailwind/react"; import { useMemo } from "react"; import { SocialIconVariant } from "./types.esm.js"; import { DiscordIcon } from "./socialIcons/Discord.esm.js"; import { TelegramIcon } from "./socialIcons/Telegram.esm.js"; import { XIcon } from "./socialIcons/X.esm.js"; import { LinkLargeIcon } from "./socialIcons/LinkLarge.esm.js"; import { DiscordLargeIcon } from "./socialIcons/DiscordLarge.esm.js"; import { TelegramLargeIcon } from "./socialIcons/TelegramLarge.esm.js"; import { FarcasterLargeIcon } from "./socialIcons/FarcasterLarge.esm.js"; import { XLargeIcon } from "./socialIcons/XLarge.esm.js"; import { YoutubeIcon } from "./socialIcons/Youtube.esm.js"; import { ShopifyIcon } from "./socialIcons/Shopify.esm.js"; import { MailIcon } from "./socialIcons/Mail.esm.js"; const DEFAULT_ICON_COLOR = "#C4C5D5"; const DEFAULT_LARGE_ICON_COLOR = "white"; const SocialIcon = ({ variant, iconColor, className, ...props }) => { const social = useMemo(() => { switch (variant) { case SocialIconVariant.DISCORD: return /* @__PURE__ */ jsx(DiscordIcon, { color: iconColor }); case SocialIconVariant.TELEGRAM: return /* @__PURE__ */ jsx(TelegramIcon, { color: iconColor }); case SocialIconVariant.X: return /* @__PURE__ */ jsx(XIcon, { color: iconColor }); case SocialIconVariant.DISCORD_LG: return /* @__PURE__ */ jsx(DiscordLargeIcon, { color: iconColor }); case SocialIconVariant.TELEGRAM_LG: return /* @__PURE__ */ jsx(TelegramLargeIcon, { color: iconColor }); case SocialIconVariant.FARCASTER_LG: return /* @__PURE__ */ jsx(FarcasterLargeIcon, { color: iconColor }); case SocialIconVariant.X_LG: return /* @__PURE__ */ jsx(XLargeIcon, { color: iconColor }); case SocialIconVariant.LINK_LG: return /* @__PURE__ */ jsx(LinkLargeIcon, { color: iconColor }); case SocialIconVariant.YOUTUBE: return /* @__PURE__ */ jsx(YoutubeIcon, { color: iconColor }); case SocialIconVariant.SHOPIFY: return /* @__PURE__ */ jsx(ShopifyIcon, { color: iconColor }); case SocialIconVariant.MAIL: return /* @__PURE__ */ jsx(MailIcon, { color: iconColor }); default: return null; } }, [variant, iconColor]); return /* @__PURE__ */ jsx(Fragment, { children: Object.values(SocialIconVariant).includes(variant) ? /* @__PURE__ */ jsx( IconButton, { className: `rounded-full bg-whiteSmoke bg-opacity-8 ${className ? className : ""}`, ...props, children: social } ) : null }); }; export { DEFAULT_ICON_COLOR, DEFAULT_LARGE_ICON_COLOR, SocialIcon }; //# sourceMappingURL=SocialIcon.esm.js.map