์๋๋ฏธ (With Me) ์คํฐ๋ ๋งค์นญ ์๋น์ค ์
๋๋ค.
- WithMe ๋์์ธ ์์คํ npm
- WithMe ์คํ ๋ฆฌ๋ถ ๋์์ธ ์์คํ ๊ฐ์ด๋
- WithMe ๋ฐฑ์๋ ๋ ํฌ์งํ ๋ฆฌ
- eslint-plugin-sort-keys-custom-order: type๊ณผ object์ ํค๋ฅผ ์๋์ผ๋ก ์ ๋ ฌ ํด์ฃผ๋ ํ๋ฌ๊ทธ์ธ
- eslint-plugin-simple-import-sort: import/export๋ฅผ ์๋์ผ๋ก ์ ๋ ฌํด์ฃผ๋ ํ๋ฌ๊ทธ์ธ
- eslint-plugin-import: eslint-plugin-simple-import-sort์ ํจ๊ป ์ฌ์ฉํ์ฌ ๊ธฐ๋ฅ ํ์ฅ
- eslint-plugin-unused-imports: ์ฌ์ฉํ์ง ์๋ ๊ฒ์ ์ญ์ ํ๊ฑฐ๋ ๋๋ฝ ๋ ๊ฒ์ ์๋์ผ๋ก ์ถ๊ฐํ๋ ํ๋ฌ๊ทธ์ธ
| LeeBonHoon | changyuyeo | KimTeaSick |
|---|---|---|
Lee-bonhoon: ๋ฉ์ธ ํ์ด์ง, ํ ๋ฆฌ์คํธchangyuyeo: ํธ์คํธ ํ์ด์ง, ์์ธ ํ์ด์งKimTeaSick: ๋ง์ด ํ์ด์ง
ย ๐ Branches
๊ฐ์ ๋ธ๋์น์์ ์์
, ์์
์ด ์๋ฃ ๋์๋ค๋ฉด master๋ธ๋์น์ PR ํ merge ์์ฒญ
merge๊ฐ ์๋ฃ๋๋ฉด ๋ค๋ฅธ ๊ฐ๋ฐ์์๊ฒ pull ์์ฒญํ๊ธฐ
master ๋ธ๋์น๊ฐ ์
๋ฐ์ดํธ ๋๋ฉด ํญ์ pull ๋ฐ์์ค์ผ ์ถฉ๋์ด ๋์ง ์์ต๋๋ค!
// ์ ๋ธ๋์น ๋ง๋ค๊ธฐ
git checkout -b "์ ๋ธ๋์น ์ด๋ฆ"
// ๋ธ๋์น ์ด๋
git checkout "๋ธ๋์น ์ด๋ฆ"
ย ๐ช Hooks
import { FC } from 'react';
import useModal from '@hooks/useModal';
//* ๋ชจ๋ฌ์ฐฝ ์์ ๋ค์ด๊ฐ ์ปจํ
์ธ
const TestModal: FC<{ onCloseModal: () => void }> = ({ onCloseModal }) => (
<div
style={{
background: 'white',
width: '568px',
height: '400px',
borderRadius: '10px',
padding: '20px'
}}
>
๋ชจ๋ฌ ๋ด์ฉ... <br /> <button onClick={onCloseModal}>๋ชจ๋ฌ์ฐฝ ๋ซ๊ธฐ</button>
</div>
);
const HostPage = () => {
//* useModal ์ฌ์ฉ
//* ModalPortal: root-modal ์ด๋ผ๋ id์ ๋ชจ๋ฌ ๋๋๋ง (children ์ผ๋ก ๋ชจ๋ฌ ์ปดํฌ๋ํธ ๋ง๋ค์ด์ ๋ฃ์ด์ฃผ๋ฉด ๋ฉ๋๋ค.)
//* onCloseModal: ๋ชจ๋ฌ์ฐฝ ์คํ ์ด๋ฒคํธ
//* onOpenModal: ๋ชจ๋ฌ์ฐฝ ๋ซ๋ ์ด๋ฒคํธ
const { ModalPortal, onCloseModal, onOpenModal } = useModal();
return (
<>
<button onClick={onOpenModal}>๋ชจ๋ฌ์ฐฝ ์ด๊ธฐ</button>
<ModalPortal>
<TestModal onCloseModal={onCloseModal} />
</ModalPortal>
</>
);
};
export default HostPage;useModal์ ์ฌ์ฉํด ModalPortal, onCloseModal, onOpenModal์ ์ฌ์ฉํด์ ๋ชจ๋ฌ์ฐฝ์ ๊ด๋ฆฌํ๋ฉด ๋ฉ๋๋ค.onOpenModal๋ฉ์๋๋ฅผ ์ฌ์ฉ ์ ๋ชจ๋ฌ์ฐฝ์ด ์คํ๋๋ฉฐ id๊ฐ root-modal ์ด๋ผ๋ ์์์ModalPortal์ปดํฌ๋ํธ๋ฅผ ๋๋๋ง ํ๊ฒ ๋ฉ๋๋ค. (react-portal ํ์ฉ)onCloseModal์ด๋ฒคํธ ๋ฐ์ ์ ํด๋น ๋ชจ๋ฌ์ฐฝ์ ๋ซํ๊ฒ ๋ฉ๋๋ค.- ์ค๋ณต๋๋ ๋ถ๋ถ์ ์ปค์คํ ํ ์ผ๋ก ๋ง๋ค์์ผ๋ฉฐ react portal ๋ฅผ ํ์ฉํด root์ ๋ฐ๊นฅ์์ ๋๋๋ง ํ๊ธฐ ๋๋ฌธ์ ํจ์ฌ ํธ๋ฆฌํ๊ฒ ์ฌ์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค.
DOM Tree ์์์์ ๋ถ๋ชจ-์์ ๊ฐ์ ์ ์ฝ์์ ์์ ๋ก์์ง๊ธฐ ์ํด Portal ๊ธฐ๋ฅ์ ์ฌ์ฉํ๊ฒ ๋๋ ๊ฒ์ ๋๋ค.
๋ํ, Portal์ ๋ ๋๋ง๋ ์์์์๋ ์ด๋ฒคํธ ๋ฒ๋ธ๋ง์ด ๋ฐ์๋๊ธฐ ๋๋ฌธ์ ๋ถ๋ชจ์์์์ ํต์ ์ธก๋ฉด์์๋ ์ ์ฉํฉ๋๋ค.
ย ๐ฅ Available URI
ย ๐ Skeleton
|-- /src
| |-- /assets
| | |-- ...
| |-- /components
| | |-- ...
| |-- /hooks
| | |-- useInput.ts
| | |-- useModal.tsx
| |-- /lib
| | |-- /api
| | | |-- ...
| |-- /pages
| | |-- \_app.tsx
| | |-- \_document.tsx
| | |-- ...
| |-- /store
| | |-- index.ts
| | |-- rootReducer.ts
| | |-- ...
| |-- /styles
| |-- /typings
| |-- ...
ย ๐ Conventional Commits
| message | descripton |
|---|---|
| feat | ์๋ก์ด ๊ธฐ๋ฅ ์ถ๊ฐ |
| fix | ๋ฒ๊ทธ ์์ |
| test | Test ๊ด๋ จํ ์ฝ๋์ ์ถ๊ฐ, ์์ |
| refactor | ์ฝ๋๋ฅผ ๋ฆฌํํ ๋ง |
| chore | (์ฝ๋์ ์์ ์์ด) ์ค์ ์ ๋ณ๊ฒฝ |
| docs | ๋ฌธ์์ ์์ |
| style | (์ฝ๋์ ์์ ์์ด) ์คํ์ผ(style)๋ง ๋ณ๊ฒฝ (๋ค์ฌ์ฐ๊ธฐ ๊ฐ์ ํฌ๋งท์ด๋ ์ธ๋ฏธ์ฝ๋ก ์ ๋นผ๋จน์ ๊ฒฝ์ฐ) |
commit example
git commit -m "feat: ์ ์ ๋ก๊ทธ์ธ ๊ธฐ๋ฅ ์ถ๊ฐ"
Commitizen ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ผ๋ก ์ ๋ฐฉ๋ฒ๋ณด๋ค๋ ์๋๋ฐฉ๋ฒ์ ์ถ์ฒํฉ๋๋ค.
yarn commit
yarn commit ์ ํด์ฃผ์๊ณ ์ปค๋ฐ์ ํ์
, ์ ๋ชฉ, ์ค๋ช
๋ฑ ๊ฐ์ด๋๋๋ก ์
๋ ฅํ ํ ๊ฐ๊ฐ ๋ธ๋์น์ push ํด์ฃผ์๋ฉด ๋ฉ๋๋ค!
yarn commit ๋ช ๋ น์ด๋ ์ ์ผ ๋จผ์ git add๋ฅผ ํด์ฃผ๊ธฐ ๋๋ฌธ์ git add ๋ช ๋ น์ด๋ ๋ฐ๋ก ์ ๋ ฅ์ํด์ฃผ์ ๋ ๋ฉ๋๋ค!
