GithubHelp home page GithubHelp logo

next-tailwind-husky-eslint's Introduction

ディレクトリ構成

src
├─ components
│ ├─ pages     : 1つのページを表すComponent。
│ │              hoge.page.tsx: layoutsにhoge.tsxを嵌めたコンポーネント。src/pages配下のルーティングファイルが参照する。
│ │              hoge.tsx: featuresやuiを組み合わせてpageの中身(main部分)となるコンポーネント
│ ├─ features  : 各機能に関心を持つComponent(例えばuser, article, category...のようなやつ)
│ ├─ ui        : featureに関心を持たない、見た目を伴うComponent(Buttonとか)
│ └─ layouts   : uiのうちページを横断するグローバル系のComponent(header、sidebar、navigation barとか)
├─ configs     : 設定ファイルとか
├─ hooks       : 複数のComponentで共有したいような汎用的な処理
├─ libs        : プロジェクトに依存しないライブラリ実装
└─ pages       : ルーティングのみの責務。nextjsの機能で配置するだけでルーティングしてくれる。ディレクトリ構成がそのままパスになる。
└─ styles      : globalなスタイリング定義

コンポーネントの依存ルール

    page
  ↑     ↑
layout feature
     ↑
     ui
  • 自分の横か下にある分類軸の Component のみ import してよい。
  • page 以外は自分の所属する分類軸の参照も OK

Component 構成

hoge/
├─ hoge.tsx
├─ hoge.css.ts
├─ hoge.hooks.ts … 複数のComponentで共有しないロジック(ロジックはできるだけコンポーネントに書かない)
└─ index.ts
※ components/pages配下のみ `hoge.page.tsx`がある

命名規則

  • 関数や変数名
    • 基本的にこの命名規則に従いたい(途中から参考にしててまだ統一できてない)
  • ファイル名
    • src/components 配下のtsxファイル
      • パスカル
      • 主要な公開リポジトリみた感じコンポーネントファイルは一般的にパスカルになってることが多そう
    • src/pages 配下のtsxファイル
      • ケバブ
      • pages 配下のファイル名がそのまま URL のパスになる仕様上、pages 配下のファイルはケバブが好ましい
    • tsファイル
      • キャメル

Style

  • tailwindcss
    • 大量のクラス名が用意されていて css 網羅してる。用意されたクラス名だけで細かなスタイリングができる。チートシート
  • headlessui/react
    • tailwind でスタイルされたコンポーネントを import して使用できる。複雑なコンポーネントで使用
  • heroicon
    • Taiwind ファミリーのアイコンフォント。通常の画像と違い、CSS ベースで色や大きさ、太さを調整することができる
  • styled-jsx-plugin-postcss
    • jsx ファイルに直接スタイリングかける

参考

その他使用ライブラリの概要

next-tailwind-husky-eslint's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.