Skip to content

[IDEA] Adopt Atomic Design for Shared UI #6

@kyra0126

Description

@kyra0126

📅 Date

2025-08-20

💡 Idea

Refactor the shared/ui folder using Atomic Design principles to improve reusability, scalability, and clarity.
This approach separates generic design system components from feature/domain-specific components, ensuring the codebase remains maintainable as the portfolio project grows.


Why Atomic Design?

  • Atoms: The smallest, indivisible components (Button, Tag, Icon, Toggle, etc.)
  • Molecules: Combinations of atoms forming small functional units (Card, LanguageMenu, etc.)
  • Organisms: Larger independent blocks with meaning (Navbar, Footer, Hero, etc.)
  • Layout: Wrappers responsible for consistent spacing and structure (Container, Section, Grid, etc.)

Benefits

  • Reusability: Atoms like Button are consistent and reusable across the app.
  • Scalability: Molecules and Organisms scale without collapsing into a flat UI folder.
  • Separation of Concerns: Domain-specific components stay in features/, while the design system lives in shared/ui/.
  • Layout Consistency: Dedicated shared/layout ensures uniform spacing, grid, and section wrappers.

📂 Suggested Folder Structure

shared/
  hooks/            # Generic React hooks (useMediaQuery, useMounted, etc.)
  lib/              # Pure utility functions (clsx, fetcher, etc.)
  types/            # Global types (Theme, Locale, etc.)
  styles/           # CSS tokens + Tailwind entrypoint
  layout/           # Layout-only components (Container, Section, Grid)
  ui/
    atoms/          # Button, Tag, Icon, ModeSwitch
    molecules/      # Card, LanguageMenu, SectionHeader
    organisms/      # Navbar, Footer, Hero

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions