Skip to content

04_Architecture

chaeryung edited this page Jan 2, 2023 · 3 revisions

📁 Architecture

📦public
📦src
 ├─ 📂asset
 ├─ 📂component
 │  ├─ 📂Home
 │  ├─ 📂Login
 │  ├─ 📂Post
 │  ├─ 📂Product
 │  ├─ 📂Profile
 │  └─ 📂common
 ├─ 📂constant
 ├─ 📂hook
 ├─ 📂lib
 │ ├─ 📂api
 │ ├─ 📂auth
 │ └─ 📂storage
 ├─ 📂page
 │ ├─ 📂404
 │ ├─ 📂Chat
 │ ├─ 📂Home
 │ ├─ 📂Landing
 │ ├─ 📂Login
 │ ├─ 📂Post
 │ ├─ 📂Product
 │ ├─ 📂Profile
 ├─ 📂style
 ├─ 📂util
 ├─ 📃App.jsx
 └─ 📃index.jsx

📁 Directory

  • 폴더명은 Camel Case로 생성한다.
  • src 폴더의 첫 번째 자식 폴더는 첫 글자를 소문자로, 단수형으로 한다. (ex. component, asset)
  • 컴포넌트 폴더는 첫 글자를 대문자로 한다. (ex. Button)
구분 컨벤션 예시
component camelCase component/template

📄 Files

  • 파일명은 Pascal Case로 생성한다.
  • Page외 Component는 디렉토리 & index.jsx로 생성한다. (이 경우, 디렉토리가 파일 생성 규칙에 따름)
  • 컴포넌트 폴더 안 파일은 index.jsx로 관리한다.
  • 컴포넌트와 스토리 파일은 반드시 1:1 구조를 가져야 한다.
구분 컨벤션 예시
component PascalCase Button/index.jsx

파일 상단 import 문 순서

  1. 라이브러리
  2. 컴포넌트
  3. 상수, 이미지 등의 etc
import styled, { css } from "styled-components";
import PropTypes from "prop-types";

import Side from "./Side";

import { PROFILE_SIZE } from "constant/sizes";

Clone this wiki locally