import { APPEARANCE_FIELD_ROW, APPEARANCE_GRID, AppearanceControls, AppearancePresets, AppearanceSection, } from "@/components/ui/appearance-design"; import { AppearancePreview } from "@/components/ui/appearance-preview"; import { GlobalColorPicker } from "@/components/ui/global-color-picker"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Switch } from "@/components/ui/switch"; import { Currency, CustomizationSettings, defaultCurrencySwitcherSettings, flagSizeOptions, flagStyleOptions, layoutOptions, ShortcodeSettings, switcherPresets, } from "../../config"; import { CurrencySwitcherPreview } from "../currency-switcher-preview"; interface CustomizationsTabProps { settings: CustomizationSettings; shortcodeSettings: ShortcodeSettings; currencies: Currency[]; updateSettings: ( key: K, value: CustomizationSettings[K], ) => void; updateShortcodeSettings: ( key: K, value: ShortcodeSettings[K], ) => void; isPro: boolean; } export function CustomizationsTab({ settings, shortcodeSettings, currencies, updateSettings, updateShortcodeSettings, isPro, }: CustomizationsTabProps) { const designValues = { ...shortcodeSettings, selectedPreset: settings.selectedPreset, }; const designDefaults = { ...defaultCurrencySwitcherSettings.shortcode, selectedPreset: "default", }; const designPresets = switcherPresets .filter((preset) => preset.id !== "custom") .map((preset) => ({ id: preset.id, name: preset.name, description: preset.description, isPro: preset.isPro, values: { selectedPreset: preset.id }, })); const applyDesign = (values: Partial) => { if (values.selectedPreset) updateSettings("selectedPreset", values.selectedPreset); Object.keys(shortcodeSettings).forEach((key) => { const field = key as keyof ShortcodeSettings; if (values[field] !== undefined) updateShortcodeSettings( field, values[field] as ShortcodeSettings[typeof field], ); }); }; const resetDesign = () => applyDesign(designDefaults); return (
{/* Left Column - Settings */}
{/* Preset Styles */} {/* Customize Design — single card with all accordion sections */}
updateShortcodeSettings("backgroundColor", v)} globalTokenId="background" featureDefault="#ffffff" /> updateShortcodeSettings("textColor", v)} globalTokenId="text" featureDefault="#1f2937" /> updateShortcodeSettings("borderColor", v)} globalTokenId="border" featureDefault="#e5e7eb" /> updateShortcodeSettings("hoverBackgroundColor", v) } featureDefault="#f3f4f6" /> updateShortcodeSettings("hoverTextColor", v)} featureDefault="#111827" />
updateShortcodeSettings("borderRadius", e.target.value) } placeholder="6px" />
updateShortcodeSettings("fontSize", e.target.value) } placeholder="14px" />
{isPro && (

Display country flags next to currencies

updateShortcodeSettings("showFlags", checked) } />

Display the full currency name

updateShortcodeSettings("showCurrencyName", checked) } />

Display the currency code (e.g., "USD")

updateShortcodeSettings("showCurrencyCode", checked) } />

Display the currency symbol (e.g., "$")

updateShortcodeSettings("showCurrencySymbol", checked) } />
)} {isPro && (
updateShortcodeSettings("dropdownWidth", e.target.value) } placeholder="200px" />
)} {isPro && (
)}
{/* Right Column - Sticky Preview */} {() => ( )}
); }