/** * Globals Preview — live preview panel showing all tokens in context * * Renders sample UI elements (buttons, headings, body text, cards, badges) * styled with the current global tokens so the user can see changes in real-time. */ import { Card, CardContent } from '@/components/ui/card' import { GlobalStyles, GlobalColor, GlobalTypography } from '../config' import { getAllGoogleFontsPreviewUrls } from '@/lib/google-fonts' interface GlobalsPreviewProps { settings: GlobalStyles } export function GlobalsPreview({ settings }: GlobalsPreviewProps) { const { colors, typography } = settings const getColor = (id: string) => colors.find((c: GlobalColor) => c.id === id)?.value ?? '#888' const getTypo = (id: string) => typography.find((t: GlobalTypography) => t.id === id) const headingTypo = getTypo('headings') const bodyTypo = getTypo('body') const headingStyle: React.CSSProperties = { fontFamily: headingTypo?.fontFamily || 'inherit', fontWeight: Number(headingTypo?.fontWeight || 600), fontSize: headingTypo?.fontSize ? `${headingTypo.fontSize}px` : undefined, lineHeight: headingTypo?.lineHeight || undefined, letterSpacing: headingTypo?.letterSpacing || undefined, textTransform: (headingTypo?.textTransform || 'none') as React.CSSProperties['textTransform'], color: getColor('text'), } const bodyStyle: React.CSSProperties = { fontFamily: bodyTypo?.fontFamily || 'inherit', fontWeight: Number(bodyTypo?.fontWeight || 400), fontSize: bodyTypo?.fontSize ? `${bodyTypo.fontSize}px` : '14px', lineHeight: bodyTypo?.lineHeight || '1.6', letterSpacing: bodyTypo?.letterSpacing || undefined, textTransform: (bodyTypo?.textTransform || 'none') as React.CSSProperties['textTransform'], color: getColor('text'), } return (
This is how your body text will appear across all Swift Commerce features. The quick brown fox jumps over the lazy dog. Typography settings include font family, weight, size, line height, letter spacing, and text transform.
Secondary body text with reduced emphasis. Product descriptions, form labels, and notification messages will use this typography.
Product description text
{t.name}
The quick brown fox jumps over the lazy dog.