diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..ecb145c --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,14 @@ +language: ko-KR +early_access: false +reviews: + profile: "chill" + request_changes_workflow: false + high_level_summary: true + poem: false + review_status: true + collapse_walkthrough: false + auto_review: + enabled: true + drafts: false +chat: + auto_reply: true diff --git a/04-form/README.md b/04-form/README.md new file mode 100644 index 0000000..b029ec9 --- /dev/null +++ b/04-form/README.md @@ -0,0 +1,38 @@ +# 04. 폼 UI 구현하기: controlled vs uncontrolled + +## 🎯 요구 사항 +- `Header`의 레스토랑 추가 버튼을 클릭하면 레스토랑 추가 폼이 모달로 뜨도록 구현해 주세요 + - 이전 단계에서 만들어두었던 `AddRestaurantModal`을 그대로 사용합니다. +- 카테고리를 선택하고, ``, ` - - 메뉴 등 추가 정보를 입력해 주세요. - - +
+ + + + 메뉴 등 추가 정보를 입력해 주세요. + +
-
- -
- - - +
+ +
+ + ); } diff --git a/src/components/AddRestaurantModal/AddRestaurantModal.module.css b/src/components/AddRestaurantModal/AddRestaurantModal.module.css index e9ee9e7..58dd401 100644 --- a/src/components/AddRestaurantModal/AddRestaurantModal.module.css +++ b/src/components/AddRestaurantModal/AddRestaurantModal.module.css @@ -1,36 +1,3 @@ -.modal { - display: none; -} - -.modal--open { - display: block; -} - -.modal__backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - - background: rgba(0, 0, 0, 0.35); -} - -.modal__container { - position: fixed; - bottom: 0; - width: 100%; - - padding: 32px 16px; - - border-radius: 8px 8px 0px 0px; - background: var(--grey-100); -} - -.modal__title { - margin-bottom: 36px; -} - .formItem { display: flex; flex-direction: column; diff --git a/src/components/CategoryFilter/CategoryFilter.jsx b/src/components/CategoryFilter/CategoryFilter.jsx index c2789c5..60f56b7 100644 --- a/src/components/CategoryFilter/CategoryFilter.jsx +++ b/src/components/CategoryFilter/CategoryFilter.jsx @@ -1,6 +1,7 @@ +import { CATEGORIES } from "../../constants/categories"; import styles from "./CategoryFilter.module.css"; -export default function CategoryFilter({ category, onChangeCategory }) { +export default function CategoryFilter({ category, onCategoryChange }) { return (
); diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 01c061e..512a3c9 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -1,7 +1,7 @@ import styles from "./Header.module.css"; import addButton from "../../assets/add-button.png"; -export default function Header() { +export default function Header({ onAddButtonClick }) { return (

점심 뭐 먹지

@@ -9,6 +9,7 @@ export default function Header() { type="button" className={styles.gnb__button} aria-label="음식점 추가" + onClick={onAddButtonClick} > 음식점 추가 diff --git a/src/components/Modal/Modal.jsx b/src/components/Modal/Modal.jsx new file mode 100644 index 0000000..1164c19 --- /dev/null +++ b/src/components/Modal/Modal.jsx @@ -0,0 +1,13 @@ +import styles from "./Modal.module.css"; + +export default function Modal({ children, title, onClose }) { + return ( + <> +
+
+

{title}

+ {children} +
+ + ); +} diff --git a/src/components/Modal/Modal.module.css b/src/components/Modal/Modal.module.css new file mode 100644 index 0000000..0937846 --- /dev/null +++ b/src/components/Modal/Modal.module.css @@ -0,0 +1,24 @@ +.modal__backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + + background: rgba(0, 0, 0, 0.35); +} + +.modal__container { + position: fixed; + bottom: 0; + width: 100%; + + padding: 32px 16px; + + border-radius: 8px 8px 0px 0px; + background: var(--grey-100); +} + +.modal__title { + margin-bottom: 36px; +} diff --git a/src/components/RestaurantDetailModal/RestaurantDetailModal.jsx b/src/components/RestaurantDetailModal/RestaurantDetailModal.jsx index 00e7937..93256b1 100644 --- a/src/components/RestaurantDetailModal/RestaurantDetailModal.jsx +++ b/src/components/RestaurantDetailModal/RestaurantDetailModal.jsx @@ -1,25 +1,20 @@ import styles from "./RestaurantDetailModal.module.css"; +import Modal from "../Modal/Modal"; export default function RestaurantDetailModal({ restaurant, onClose }) { return ( -
-
-
-

- {restaurant.name} -

-
-

{restaurant.description}

-
-
- -
+ +
+

{restaurant.description}

-
+
+ +
+ ); } diff --git a/src/components/RestaurantDetailModal/RestaurantDetailModal.module.css b/src/components/RestaurantDetailModal/RestaurantDetailModal.module.css index 0ae7b8d..56deefd 100644 --- a/src/components/RestaurantDetailModal/RestaurantDetailModal.module.css +++ b/src/components/RestaurantDetailModal/RestaurantDetailModal.module.css @@ -1,36 +1,3 @@ -.modal { - display: none; -} - -.modal--open { - display: block; -} - -.modal__backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - - background: rgba(0, 0, 0, 0.35); -} - -.modal__container { - position: fixed; - bottom: 0; - width: 100%; - - padding: 32px 16px; - - border-radius: 8px 8px 0px 0px; - background: var(--grey-100); -} - -.modal__title { - margin-bottom: 36px; -} - .modal__buttonContainer { display: flex; } diff --git a/src/components/RestaurantList/RestaurantList.jsx b/src/components/RestaurantList/RestaurantList.jsx index 7fbdb78..0150f7f 100644 --- a/src/components/RestaurantList/RestaurantList.jsx +++ b/src/components/RestaurantList/RestaurantList.jsx @@ -7,26 +7,24 @@ export default function RestaurantList({ restaurants, onRestaurantClick }) {