From ed17859f535e617573648a9d32468ff9363c1531 Mon Sep 17 00:00:00 2001 From: "(hoooooony)" <(cjh41820@gmail.com)> Date: Mon, 27 Nov 2023 16:36:13 +0900 Subject: [PATCH 01/39] =?UTF-8?q?feat:=20=EA=B0=80=EA=B2=A9=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B2=84=ED=8A=BC=20=EB=8F=99=EC=9E=91=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MenuPrice/MenuPrice.module.scss | 83 ++++++++++++------- .../AddMenu/components/MenuPrice/index.tsx | 79 +++++++++++++----- 2 files changed, 113 insertions(+), 49 deletions(-) diff --git a/src/page/AddMenu/components/MenuPrice/MenuPrice.module.scss b/src/page/AddMenu/components/MenuPrice/MenuPrice.module.scss index 0e5e1e44..63f4c578 100644 --- a/src/page/AddMenu/components/MenuPrice/MenuPrice.module.scss +++ b/src/page/AddMenu/components/MenuPrice/MenuPrice.module.scss @@ -44,17 +44,18 @@ &__price-info-input-box { margin-top: 10px; display: flex; + justify-content: space-between; align-items: center; gap: 4px; } &__price-info-inputs { display: flex; + width: 100%; align-items: center; gap: 8px; - width: 100%; - input { + &__size-input { width: 100%; height: 35px; border: 0.5px solid #898a8d; @@ -67,21 +68,33 @@ font-weight: 400; } } - } - &__price-input-box { - position: relative; - width: 100%; + &__price-input-box { + position: relative; + width: 100%; + } + + &__price-input { + width: 100%; + height: 35px; + border: 0.5px solid #898a8d; + padding: 8px; + box-sizing: border-box; + } + + &__price-input-won { + box-sizing: border-box; + position: absolute; + right: 8px; + top: 32%; + color: #a1a1a1; + font-size: 13px; + font-weight: 400; + } } - &__price-input-won { - box-sizing: border-box; - position: absolute; - right: 8px; - top: 32%; - color: #a1a1a1; - font-size: 13px; - font-weight: 400; + &__cancle-button { + background-color: white; } &__cancle-icon { @@ -99,6 +112,7 @@ align-items: center; margin-top: 16px; gap: 8px; + background-color: white; &__icon { width: 12px; @@ -161,13 +175,19 @@ } } -.price-info-inputs { +.price-info-input-box { margin-top: 24px; display: flex; gap: 16px; align-items: center; +} - .size-input { +.price-info-inputs { + display: flex; + gap: 16px; + align-items: center; + + &__size-input { box-sizing: border-box; width: 335px; height: 62px; @@ -184,16 +204,16 @@ font-weight: 400; } } -} -.prcie-input-box { - position: relative; - box-sizing: border-box; - width: 335px; - height: 62px; - border: 0.5px solid #858585; + &__price-input-box { + position: relative; + box-sizing: border-box; + width: 335px; + height: 62px; + border: 0.5px solid #858585; + } - .price-input { + &__price-input { text-align: right; box-sizing: border-box; width: 303px; @@ -206,7 +226,7 @@ outline: none; } - .price-input-won { + &__price-input-won { position: absolute; top: 32%; right: 10px; @@ -216,12 +236,18 @@ } } -.cancle-icon { +.cancle-button { width: 24px; height: 24px; + background-color: white; - &:hover { - cursor: pointer; + &__icon { + width: 24px; + height: 24px; + + &:hover { + cursor: pointer; + } } } @@ -232,6 +258,7 @@ gap: 8px; height: 28px; width: 107px; + background-color: white; &__icon { width: 24px; diff --git a/src/page/AddMenu/components/MenuPrice/index.tsx b/src/page/AddMenu/components/MenuPrice/index.tsx index d259c577..718e285e 100644 --- a/src/page/AddMenu/components/MenuPrice/index.tsx +++ b/src/page/AddMenu/components/MenuPrice/index.tsx @@ -1,12 +1,23 @@ import useMediaQuery from 'utils/hooks/useMediaQuery'; +import { useState } from 'react'; import { ReactComponent as PlusIcon } from 'assets/svg/main/plus.svg'; -import { ReactComponent as CancleIcon } from 'assets/svg/mystore/x-in-circle-cancle.svg'; +import { ReactComponent as DeleteIcon } from 'assets/svg/addmenu/delete-icon.svg'; +import { ReactComponent as MobileDeleteIcon } from 'assets/svg/addmenu/mobile-delete-icon.svg'; import { ReactComponent as CheckCircleIcon } from 'assets/svg/mystore/check-circle.svg'; import { ReactComponent as MobilePlusIcon } from 'assets/svg/addmenu/mobile-plus-icon.svg'; import styles from './MenuPrice.module.scss'; export default function MenuPrice() { const { isMobile } = useMediaQuery(); + const [priceInputs, setPriceInputs] = useState([{ id: 1 }]); + + const addPriceInput = () => { + setPriceInputs([...priceInputs, { id: priceInputs.length + 1 }]); + }; + const deletePriceInput = (id : number) => { + setPriceInputs(priceInputs.filter((input) => input.id !== id)); + }; + return (
{isMobile ? ( @@ -18,20 +29,32 @@ export default function MenuPrice() {
-
-
- -
- - + {priceInputs.map((input) => ( +
+
+ +
+ +

+
+
- -
-
+ ))} +
+ 가격 추가 +
) : (
@@ -42,18 +65,32 @@ export default function MenuPrice() {
-
- -
- - + {priceInputs.map((input) => ( +
+
+ +
+ +

+
+
+
- -
-
+ ))} +
+
)} From a94185df49d2e16ef3774c2b5fdacaa2b7f5ed04 Mon Sep 17 00:00:00 2001 From: "(hoooooony)" <(cjh41820@gmail.com)> Date: Tue, 2 Jan 2024 19:41:43 +0900 Subject: [PATCH 02/39] =?UTF-8?q?feat:=20=EB=AA=A8=EB=B0=94=EC=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=B6=94=EA=B0=80=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../svg/addmenu/mobile-delete-new-image.svg | 3 + .../components/AddMenuImgModal/index.tsx | 35 +++- .../MenuCategory/MenuCategory.module.scss | 19 ++ .../AddMenu/components/MenuCategory/index.tsx | 149 +++++++++----- .../MenuDetail/MenuDetail.module.scss | 16 +- .../AddMenu/components/MenuDetail/index.tsx | 34 ++- .../MenuImage/MenuImage.module.scss | 39 +++- .../AddMenu/components/MenuImage/index.tsx | 33 ++- .../components/MenuName/MenuName.module.scss | 7 +- .../AddMenu/components/MenuName/index.tsx | 39 +++- .../MenuPrice/MenuPrice.module.scss | 24 ++- .../AddMenu/components/MenuPrice/index.tsx | 193 ++++++++++++------ src/page/AddMenu/index.tsx | 118 +++++++---- 13 files changed, 545 insertions(+), 164 deletions(-) create mode 100644 src/assets/svg/addmenu/mobile-delete-new-image.svg diff --git a/src/assets/svg/addmenu/mobile-delete-new-image.svg b/src/assets/svg/addmenu/mobile-delete-new-image.svg new file mode 100644 index 00000000..f9943cc1 --- /dev/null +++ b/src/assets/svg/addmenu/mobile-delete-new-image.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/page/AddMenu/components/AddMenuImgModal/index.tsx b/src/page/AddMenu/components/AddMenuImgModal/index.tsx index 6ead02a9..e858c6b1 100644 --- a/src/page/AddMenu/components/AddMenuImgModal/index.tsx +++ b/src/page/AddMenu/components/AddMenuImgModal/index.tsx @@ -1,13 +1,37 @@ +// 필요한 모듈과 컴포넌트 임포트 import { createPortal } from 'react-dom'; +import { useRef } from 'react'; import { ReactComponent as CancleIcon } from 'assets/svg/addmenu/mobile-cancle-icon.svg'; import styles from './AddMenuImgModal.module.scss'; interface AddMenuImgModalProps { isOpen: boolean; onCancel: (event: React.MouseEvent | React.KeyboardEvent) => void; + onImageSelect: (image: string) => void; // 이미지 선택 콜백 함수 } -export default function AddMenuImgModal({ isOpen, onCancel }: AddMenuImgModalProps) { +export default function AddMenuImgModal({ isOpen, onCancel, onImageSelect }: AddMenuImgModalProps) { + const fileInputRef = useRef(null); // 파일 입력을 위한 ref + + const handleFileChange = (event: React.ChangeEvent) => { + const { files } = event.target; + if (files && files.length > 0) { + const file = files[0]; + const reader = new FileReader(); + + reader.onloadend = () => { + if (reader.result && typeof reader.result === 'string') { + onImageSelect(reader.result); + } + }; + reader.readAsDataURL(file); + } + }; + + const triggerFileInput = () => { + fileInputRef.current?.click(); // 파일 입력 트리거 + }; + if (!isOpen) return null; return createPortal( @@ -34,10 +58,17 @@ export default function AddMenuImgModal({ isOpen, onCancel }: AddMenuImgModalPro 이미지 추가 메뉴 사진을 추가 할 수 있습니다.
+ diff --git a/src/page/AddMenu/components/MenuCategory/MenuCategory.module.scss b/src/page/AddMenu/components/MenuCategory/MenuCategory.module.scss index 4ea0cd3a..05f8e14b 100644 --- a/src/page/AddMenu/components/MenuCategory/MenuCategory.module.scss +++ b/src/page/AddMenu/components/MenuCategory/MenuCategory.module.scss @@ -63,6 +63,18 @@ $button-text-color: #252525; } } +.category-text-container { + margin-top: 12px; + display: flex; + align-items: center; + gap: 15px; +} + +.category-text { + font-size: 20px; + font-weight: 500; +} + .mobile { &__container { width: 100%; @@ -120,4 +132,11 @@ $button-text-color: #252525; cursor: pointer; } } + + &__category-text-container { + margin-top: 12px; + display: flex; + align-items: center; + gap: 10px; + } } diff --git a/src/page/AddMenu/components/MenuCategory/index.tsx b/src/page/AddMenu/components/MenuCategory/index.tsx index 879cc48b..64252899 100644 --- a/src/page/AddMenu/components/MenuCategory/index.tsx +++ b/src/page/AddMenu/components/MenuCategory/index.tsx @@ -8,8 +8,11 @@ interface MenuCategory { id: number; name: string; } +interface MenuCategoryProps { + isComplete: boolean; +} -export default function MenuCategory() { +export default function MenuCategory({ isComplete }:MenuCategoryProps) { const { isMobile } = useMediaQuery(); const [menuCategories/* , setMenuCategories */] = useState([ { id: 1, name: '이벤트 메뉴' }, @@ -31,61 +34,109 @@ export default function MenuCategory() {
{isMobile ? (
-
-
-
- 메뉴 카테고리 + {isComplete ? ( + <> +
+
+
+ 메뉴 카테고리 +
+
+
+
+ {selectedCategories.map((category, index) => ( + +
+ {category.name} +
+ {index < selectedCategories.length - 1 && /} +
+ ))} +
+ + ) : ( + <> +
+
+
+ 메뉴 카테고리 +
+
+ (최대 선택 n개) +
+
+
-
- (최대 선택 n개) +
+ {menuCategories.map((category) => ( + + ))}
-
- -
-
- {menuCategories.map((category) => ( - - ))} -
+ + )}
) : (
-
-
-
- 메뉴 카테고리 + {isComplete ? ( + <> +
+
+
+ 메뉴 카테고리 +
+
+
+
+ {selectedCategories.map((category, index) => ( + +
+ {category.name} +
+ {index < selectedCategories.length - 1 && /} +
+ ))} +
+ + ) : ( + <> +
+
+
+ 메뉴 카테고리 +
+
+ (최대 선택 n개) +
+
+
-
- (최대 선택 n개) +
+ {menuCategories.map((category) => ( + + ))}
-
- -
-
- {menuCategories.map((category) => ( - - ))} -
+ + )}
)}
diff --git a/src/page/AddMenu/components/MenuDetail/MenuDetail.module.scss b/src/page/AddMenu/components/MenuDetail/MenuDetail.module.scss index 25842ddd..35659304 100644 --- a/src/page/AddMenu/components/MenuDetail/MenuDetail.module.scss +++ b/src/page/AddMenu/components/MenuDetail/MenuDetail.module.scss @@ -17,14 +17,19 @@ height: 153px; flex-shrink: 0; padding: 16px; - border: 0.5px solid var(--stroke, #858585); - color: var(--text-color, #252525); + border: 0.5px solid #858585; + color: #252525; font-size: 20px; font-weight: 500; resize: none; + &--complete { + font-size: 20px; + font-weight: 500; + } + &::placeholder { - color: var(--stroke, #858585); + color: #858585; font-size: 20px; font-weight: 400; } @@ -52,6 +57,11 @@ resize: none; box-sizing: border-box; + &--complete { + font-size: 15px; + font-weight: 400; + } + &::placeholder { color: #a1a1a1; font-size: 13px; diff --git a/src/page/AddMenu/components/MenuDetail/index.tsx b/src/page/AddMenu/components/MenuDetail/index.tsx index ccf778ee..d3d578ad 100644 --- a/src/page/AddMenu/components/MenuDetail/index.tsx +++ b/src/page/AddMenu/components/MenuDetail/index.tsx @@ -1,21 +1,45 @@ import useMediaQuery from 'utils/hooks/useMediaQuery'; - +import { useState } from 'react'; import styles from './MenuDetail.module.scss'; -export default function MenuDetail() { +interface MenuCategoryProps { + isComplete:boolean; +} +export default function MenuDetail({ isComplete }:MenuCategoryProps) { const { isMobile } = useMediaQuery(); - + const [detail, setDetail] = useState(''); + const handleDetailChange = (e: React.ChangeEvent) => { + setDetail(e.target.value); + }; return (
{isMobile ? (
메뉴구성
-