'use client'; import React from 'react'; import { Typography as AntTypography } from 'antd'; import { designTokens } from '../../theme/designTokens'; const { Title, Paragraph, Text } = AntTypography; // ============================================================================= // TYPOGRAPHY COMPONENT INTERFACES // ============================================================================= interface BaseTypographyProps { children: React.ReactNode; className?: string; style?: React.CSSProperties; id?: string; } interface HeadingProps extends BaseTypographyProps { level?: 1 | 2 | 3 | 4 | 5; color?: 'primary' | 'secondary' | 'tertiary' | 'inverse'; gradient?: boolean; } interface BodyTextProps extends BaseTypographyProps { size?: 'large' | 'regular' | 'small'; color?: 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'inverse'; weight?: 'light' | 'regular' | 'medium' | 'semibold' | 'bold'; } interface CodeTextProps extends BaseTypographyProps { inline?: boolean; language?: string; } interface ButtonTextProps extends BaseTypographyProps { size?: 'small' | 'regular' | 'large'; } // ============================================================================= // HERO DISPLAY TYPOGRAPHY // ============================================================================= export const HeroDisplay: React.FC = ({ children, className = '', style = {}, color = 'primary', gradient = false, ...props }) => { const colorMap = { primary: 'var(--text-primary)', secondary: 'var(--text-secondary)', tertiary: 'var(--text-tertiary)', inverse: 'var(--text-inverse)', }; const heroStyles: React.CSSProperties = { fontFamily: 'var(--font-display)', fontSize: 'var(--text-hero)', fontWeight: 100, // Exo Thin lineHeight: 'var(--leading-tight)', letterSpacing: 'var(--tracking-tight)', color: gradient ? 'transparent' : colorMap[color], background: gradient ? 'linear-gradient(135deg, var(--color-primary) 0%, var(--color-success) 100%)' : 'none', WebkitBackgroundClip: gradient ? 'text' : 'initial', backgroundClip: gradient ? 'text' : 'initial', margin: 0, ...style, }; return (

{children}

); }; // ============================================================================= // DISPLAY TYPOGRAPHY HIERARCHY // ============================================================================= export const DisplayHeading: React.FC = ({ children, level = 1, className = '', style = {}, color = 'primary', gradient = false, ...props }) => { const colorMap = { primary: 'var(--text-primary)', secondary: 'var(--text-secondary)', tertiary: 'var(--text-tertiary)', inverse: 'var(--text-inverse)', }; const levelStyles = { 1: { fontSize: 'var(--text-display-1)', fontWeight: 200, // Exo ExtraLight lineHeight: 'var(--leading-snug)', }, 2: { fontSize: 'var(--text-display-2)', fontWeight: 300, // Exo Light lineHeight: 'var(--leading-normal)', }, 3: { fontSize: 'clamp(20px, 3vw, 28px)', fontWeight: 400, // Exo Regular lineHeight: 'var(--leading-normal)', }, 4: { fontSize: 'clamp(18px, 2.5vw, 24px)', fontWeight: 400, lineHeight: 'var(--leading-normal)', }, 5: { fontSize: 'clamp(16px, 2vw, 20px)', fontWeight: 500, lineHeight: 'var(--leading-normal)', }, }; const displayStyles: React.CSSProperties = { fontFamily: 'var(--font-display)', color: gradient ? 'transparent' : colorMap[color], background: gradient ? 'linear-gradient(135deg, var(--color-primary) 0%, var(--color-success) 100%)' : 'none', WebkitBackgroundClip: gradient ? 'text' : 'initial', backgroundClip: gradient ? 'text' : 'initial', letterSpacing: 'var(--tracking-snug)', margin: 0, ...levelStyles[level], ...style, }; const Tag = `h${level}` as keyof JSX.IntrinsicElements; return ( {children} ); }; // ============================================================================= // INTERFACE TYPOGRAPHY // ============================================================================= export const InterfaceText: React.FC = ({ children, size = 'regular', className = '', style = {}, color = 'primary', weight = 'medium', ...props }) => { const colorMap = { primary: 'var(--text-primary)', secondary: 'var(--text-secondary)', tertiary: 'var(--text-tertiary)', disabled: 'var(--text-disabled)', inverse: 'var(--text-inverse)', }; const sizeMap = { small: 'var(--text-interface-small)', regular: 'var(--text-interface)', large: 'var(--text-interface)', }; const weightMap = { light: 300, regular: 400, medium: 500, semibold: 600, bold: 700, }; const interfaceStyles: React.CSSProperties = { fontFamily: 'var(--font-interface)', fontSize: sizeMap[size], fontWeight: weightMap[weight], lineHeight: 'var(--leading-normal)', letterSpacing: size === 'small' ? 'var(--tracking-wider)' : 'var(--tracking-wide)', color: colorMap[color], margin: 0, ...style, }; return ( {children} ); }; // ============================================================================= // BODY TYPOGRAPHY // ============================================================================= export const BodyText: React.FC = ({ children, size = 'regular', className = '', style = {}, color = 'primary', weight = 'regular', ...props }) => { const colorMap = { primary: 'var(--text-primary)', secondary: 'var(--text-secondary)', tertiary: 'var(--text-tertiary)', disabled: 'var(--text-disabled)', inverse: 'var(--text-inverse)', }; const sizeMap = { large: 'var(--text-body-large)', regular: 'var(--text-body)', small: 'var(--text-body-small)', }; const weightMap = { light: 300, regular: 400, medium: 500, semibold: 600, bold: 700, }; const lineHeightMap = { large: 'var(--leading-reading)', regular: 'var(--leading-loose)', small: 'var(--leading-relaxed)', }; const bodyStyles: React.CSSProperties = { fontFamily: 'var(--font-body)', fontSize: sizeMap[size], fontWeight: weightMap[weight], lineHeight: lineHeightMap[size], letterSpacing: size === 'small' ? 'var(--tracking-wide)' : 'var(--tracking-normal)', color: colorMap[color], margin: 0, ...style, }; return (

{children}

); }; // ============================================================================= // CODE TYPOGRAPHY // ============================================================================= export const CodeText: React.FC = ({ children, inline = false, className = '', style = {}, language, ...props }) => { const codeStyles: React.CSSProperties = { fontFamily: 'var(--font-mono)', fontSize: inline ? '0.9em' : 'var(--text-code)', lineHeight: 'var(--leading-relaxed)', letterSpacing: 'var(--tracking-normal)', color: 'var(--text-primary)', backgroundColor: inline ? 'var(--bg-tertiary)' : 'var(--bg-secondary)', padding: inline ? '2px 6px' : 'var(--space-md)', borderRadius: inline ? '4px' : 'var(--radius-md)', border: inline ? '1px solid var(--border-secondary)' : 'none', margin: 0, ...style, }; if (inline) { return ( {children} ); } return (
      {children}
    
); }; // ============================================================================= // BUTTON TYPOGRAPHY // ============================================================================= export const ButtonText: React.FC = ({ children, size = 'regular', className = '', style = {}, ...props }) => { const sizeMap = { small: 'var(--text-interface-small)', regular: 'var(--text-interface)', large: 'var(--text-interface)', }; const buttonStyles: React.CSSProperties = { fontFamily: 'var(--font-body)', fontSize: sizeMap[size], fontWeight: 600, lineHeight: 'var(--leading-tight)', letterSpacing: 'var(--tracking-wider)', margin: 0, ...style, }; return ( {children} ); }; // ============================================================================= // UTILITY COMPONENTS // ============================================================================= export const Gradient: React.FC = ({ children, className = '', style = {}, ...props }) => { const gradientStyles: React.CSSProperties = { background: 'linear-gradient(135deg, var(--color-primary) 0%, var(--color-success) 100%)', WebkitBackgroundClip: 'text', backgroundClip: 'text', color: 'transparent', backgroundSize: '200% 200%', animation: 'gradient-shift 5s ease-in-out infinite', ...style, }; return ( {children} ); }; // ============================================================================= // COMPOUND COMPONENTS // ============================================================================= export const Typography = { Hero: HeroDisplay, Display: DisplayHeading, Interface: InterfaceText, Body: BodyText, Code: CodeText, Button: ButtonText, Gradient, // Legacy compatibility with existing components H1: (props: HeadingProps) => , H2: (props: HeadingProps) => , H3: (props: HeadingProps) => , H4: (props: HeadingProps) => , H5: (props: HeadingProps) => , P: (props: BodyTextProps) => , }; export default Typography;