"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 (
Body text sample
| Name | Size | Example |
|---|---|---|
| {item.name} | {item.size} |
{item.sample}
|
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.
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
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.