ディレクトリ構成
よく使う主な構成である。
src/
├── components/ ベースとなる汎用UIを管理する場所(デザインシステムの「ui」層)
│ ├── Button/
│ │ ├── index.tsx
│ │ └── ...
│ ├── Input/
│ │ ├── index.tsx
│ │ └── ...
│ ├── index.ts
│ └── ...
├── layouts/ アプリケーション全体で共有する専用ウィジェットを管理する場所(Headerなど)
│ ├── GlobalHeader/
│ │ └── ...
│ └── ...
├── features/ 機能ごとの関数や固有UIを管理する場所(デザインシステムの「domain」「widgets」層)
│ ├── auth/
│ │ ├── components/
│ │ │ └── ...
│ │ ├── hooks/
│ │ │ └── ...
│ │ ├── utils/
│ │ │ └── ...
│ │ └── index.ts
│ ├── SomeComponent/ 共通コンポーネントとその特化実装を管理する場合
│ │ ├── SomeComponent.tsx
│ │ ├── SomeComponent.stories.tsx
│ │ ├── index.ts
│ │ └── patterns/ 特化実装パターン
│ │ ├── pattern-a/
│ │ │ ├── PatternAComponent.tsx
│ │ │ ├── PatternAComponent.stories.tsx
│ │ │ └── index.ts
│ │ └── pattern-b/
│ │ ├── PatternBComponent.tsx
│ │ ├── PatternBComponent.stories.tsx
│ │ └── index.ts
│ └── ...
├── hooks/ ReactのHooksを管理する場所
│ ├── useFetch.ts
│ ├── useInput.ts
│ └── ...
├── pages/ URLに沿ったページをまとめる場所
│ ├── home/
│ │ ├── index.tsx
│ │ └── ...
│ ├── about/
│ │ ├── index.tsx
│ │ └── ...
│ └── ...
├── styles/ tailwind-variantsなどでまとめたStyleを管理する場所
│ ├── Button.ts
│ ├── Input.ts
│ ├── index.ts
│ └── ...
├── themes/ テーマに関連したStyleを管理する場所
│ ├── tailwind.css
│ ├── blog.css
│ ├── tokens.css