"use client" import { useState } from "react" import { typographyScales, lineHeights, letterSpacings } from "@/lib/typography" import { useDesign } from "@/contexts/design-context" import { SectionHeading } from "@/components/ui/section-heading" // Add minimal prop to the component interface TypographySectionProps { minimal?: boolean } const typographyItems = [ { name: "Display", size: "text-5xl", weight: "font-semibold tracking-tight", sample: "The quick brown fox jumps over the lazy dog", }, { name: "Heading 1", size: "text-4xl", weight: "font-semibold tracking-tight", sample: "The quick brown fox jumps over the lazy dog", }, { name: "Heading 2", size: "text-3xl", weight: "font-semibold tracking-tight", sample: "The quick brown fox jumps over the lazy dog", }, { name: "Heading 3", size: "text-2xl", weight: "font-semibold", sample: "The quick brown fox jumps over the lazy dog", }, { name: "Heading 4", size: "text-xl", weight: "font-semibold", sample: "The quick brown fox jumps over the lazy dog", }, { name: "Large", size: "text-lg", weight: "font-normal", sample: "The quick brown fox jumps over the lazy dog" }, { name: "Body", size: "text-base", weight: "font-normal", sample: "The quick brown fox jumps over the lazy dog" }, { name: "Small", size: "text-sm", weight: "font-normal", sample: "The quick brown fox jumps over the lazy dog" }, { name: "Caption", size: "text-xs", weight: "font-normal", sample: "The quick brown fox jumps over the lazy dog" }, ] export function TypographySection({ minimal = false }: TypographySectionProps) { const { font } = useDesign() const [lineHeightState, setLineHeight] = useState("normal") const [letterSpacingState, setLetterSpacing] = useState("normal") const [typographyScaleState, setTypographyScale] = useState("classic") // Extract and clean the font name const cleanFontName = font.split(" ")[0].replace(/,/g, "") // If minimal is true, return a simplified version if (minimal) { return (

Typography

Heading 1

Heading 2

Body text sample

) } // Set default values for other properties const lineHeight = "normal" const letterSpacing = "normal" const typographyScale = "classic" return (
{/* Font Preview */}
{cleanFontName}
{typographyItems.map((item, index) => ( ))}
Name Size Example
{item.name} {item.size}
{item.sample}

Typography Example

The Future of Design Systems

Building for Scale and Consistency

Design systems have become the backbone of modern digital products. They provide a unified language that bridges the gap between design and development, ensuring consistency across all touchpoints. When implemented correctly, they can dramatically reduce development time and improve user experience.

Key Benefits

  • Consistency: Unified visual language across products
  • Efficiency: Faster development with reusable components
  • Scalability: Easy to maintain and extend over time
  • Collaboration: Better communication between teams

Implementation Strategy

Start with{" "} foundational elements {" "} like typography, colors, and spacing. Then build up to more complex components. Remember that{" "} documentation is just as important as the code itself .

"A design system is a product serving products." — Nathan Curtis
Getting Started
  1. Audit your existing design patterns
  2. Define your design tokens and principles
  3. Create a component library with clear documentation
  4. Establish governance and contribution guidelines

Last updated: December 2024 • Reading time: 3 minutes

Technical Note:

This example demonstrates various text styles including bold, italic, inline code , and different heading levels. All text inherits the selected font family from the design context.

Usage Guidelines

  • Hierarchy: Use headings to establish a clear content hierarchy
  • Line length: Maintain 60-80 characters per line for optimal readability
  • Interface text: Use text-sm (14px) for most interface elements
  • Secondary text: Use text-xs (12px) for captions, labels, and metadata
  • Font weights: Limit to 2-3 weights in a single interface
  • Responsive design: Consider fluid typography for different screen sizes
  • Contrast: Ensure sufficient contrast between text and background
  • Consistency: Use consistent letter spacing and line height throughout
) }