Skip to content

๐Ÿ“š WithMe ํ”„๋ก ํŠธ์—”๋“œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ

Notifications You must be signed in to change notification settings

KimTeaSick/WithMe_FE

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š With Me FE

branches

๊ฐ์ž ๋ธŒ๋žœ์น˜์—์„œ ์ž‘์—…, ์ž‘์—…์ด ์™„๋ฃŒ ๋˜์—ˆ๋‹ค๋ฉด master๋ธŒ๋žœ์น˜์— PR ํ›„ merge ์š”์ฒญ
merge๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ๋‹ค๋ฅธ ๊ฐœ๋ฐœ์ž์—๊ฒŒ pull ์š”์ฒญํ•˜๊ธฐ
master ๋ธŒ๋žœ์น˜๊ฐ€ ์—…๋ฐ์ดํŠธ ๋˜๋ฉด ํ•ญ์ƒ pull ๋ฐ›์•„์ค˜์•ผ ์ถฉ๋Œ์ด ๋‚˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค!

// ์ƒˆ ๋ธŒ๋žœ์น˜ ๋งŒ๋“ค๊ธฐ
git checkout -b "์ƒˆ ๋ธŒ๋žœ์น˜ ์ด๋ฆ„"

// ๋ธŒ๋žœ์น˜ ์ด๋™
git checkout "๋ธŒ๋žœ์น˜ ์ด๋ฆ„"

member

LeeBonHoon changyuyeo KimTeaSick
  • Lee-bonhoon: ๋ฉ”์ธ ํŽ˜์ด์ง€, ํŒ€ ๋ฆฌ์ŠคํŠธ, ์ƒ์„ธ ํŽ˜์ด์ง€
  • changyuyeo: ํ˜ธ์ŠคํŠธ ํŽ˜์ด์ง€, ๋งˆ์ด ํŽ˜์ด์ง€
  • KimTeaSick: ํŒ€ ํŽ˜์ด์ง€ ์ „์ฒด

hooks

useModal ์‚ฌ์šฉ๋ฒ•

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์˜ ๋ฐ”๊นฅ์—์„œ ๋žœ๋”๋ง ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํ›จ์”ฌ ํŽธ๋ฆฌํ•˜๊ฒŒ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

portal๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ตฌํ˜„ํ•œ ์ด์œ 

DOM Tree ์ƒ์—์„œ์˜ ๋ถ€๋ชจ-์ž์‹ ๊ฐ„์˜ ์ œ์•ฝ์—์„œ ์ž์œ ๋กœ์›Œ์ง€๊ธฐ ์œ„ํ•ด Portal ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
๋˜ํ•œ, Portal์— ๋ Œ๋”๋ง๋œ ์ž์‹์š”์†Œ๋Š” ์ด๋ฒคํŠธ ๋ฒ„๋ธ”๋ง์ด ๋ฐ˜์˜๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ถ€๋ชจ์š”์†Œ์™€์˜ ํ†ต์‹  ์ธก๋ฉด์—์„œ๋„ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

Portals ์ฐธ๊ณ  ๋ฌธ์„œ


available URI

  • / : ๋ฉ”์ธ ํŽ˜์ด์ง€
  • /host : ์ƒˆ๋กœ์šด ํŒ€ ๋งŒ๋“ค๊ธฐ ํŽ˜์ด์ง€
  • /...

skeleton

|-- /src
|   |-- /api
|   |   |-- APIs.ts
|   |   |-- index.ts
|   |-- /assets
|   |   |-- ...
|   |-- /components
|   |   |-- ...
|   |-- /hooks
|   |   |-- useInput.ts
|   |   |-- useModal.tsx
|   |-- /lib
|   |   |-- staticData.ts
|   |-- /pages
|   |   |-- _app.tsx
|   |   |-- _document.tsx
|   |   |-- ...
|   |-- /store
|   |   |-- index.ts
|   |   |-- rootReducer.ts
|   |   |-- ...
|   |-- /styles
|   |-- /typings
|   |-- ...

commit message style

message descripton
feat ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ์ถ”๊ฐ€
fix ๋ฒ„๊ทธ ์ˆ˜์ •
test Test ๊ด€๋ จํ•œ ์ฝ”๋“œ์˜ ์ถ”๊ฐ€, ์ˆ˜์ •
refactor ์ฝ”๋“œ๋ฅผ ๋ฆฌํŽ™ํ† ๋ง
chore (์ฝ”๋“œ์˜ ์ˆ˜์ • ์—†์ด) ์„ค์ •์„ ๋ณ€๊ฒฝ
docs ๋ฌธ์„œ์˜ ์ˆ˜์ •
style (์ฝ”๋“œ์˜ ์ˆ˜์ • ์—†์ด) ์Šคํƒ€์ผ(style)๋งŒ ๋ณ€๊ฒฝ
(๋“ค์—ฌ์“ฐ๊ธฐ ๊ฐ™์€ ํฌ๋งท์ด๋‚˜ ์„ธ๋ฏธ์ฝœ๋ก ์„ ๋นผ๋จน์€ ๊ฒฝ์šฐ)

commit example

git commit -m "feat: ์œ ์ € ๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ ์ถ”๊ฐ€"

โš™ settings

dev server

yarn dev

node -v

v16.14.2

.env

NEXT_PUBLIC_API_URL=...

About

๐Ÿ“š WithMe ํ”„๋ก ํŠธ์—”๋“œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.3%
  • JavaScript 3.6%
  • Shell 0.1%