From 4455220e3f2421295339d768e85ce49159b0faf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=A8=EC=A0=95=EC=9A=B1?= <113816822+HelloWook@users.noreply.github.com> Date: Wed, 4 Dec 2024 05:10:38 +0900 Subject: [PATCH] =?UTF-8?q?style=20:=20=EB=94=94=EC=9E=90=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=9C=EC=95=88=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * style : 버튼 색상 추가 * style : button 스타일 수정 * story : 버튼 스토리 수정 * chore : 선택 로직 수정 * style : select item 스타일 수정 * style : modal 페이지 스타일링 * chore : 버튼 위치 수정 --- .../Common/BottleLetter/Label/Label.tsx | 8 ++- .../KeywordToggleButton.tsx | 2 +- .../CreateButton/CreateButton.stories.tsx | 23 ++++++++- .../Letter/CreateButton/CreateButton.tsx | 13 +++-- .../Letter/KeywordList/KeywordList.tsx | 4 +- src/components/Letter/LabelList/LabelList.tsx | 6 +-- .../Letter/SelectItem/SelectItem.tsx | 51 ++++++++----------- .../Letter/SuccessModal/SuccessModal.tsx | 2 +- .../Letter/Success/SuccessLetterPage.tsx | 16 +++--- tailwind.config.js | 9 +++- 10 files changed, 76 insertions(+), 58 deletions(-) diff --git a/src/components/Common/BottleLetter/Label/Label.tsx b/src/components/Common/BottleLetter/Label/Label.tsx index cddda168..6ab9a128 100644 --- a/src/components/Common/BottleLetter/Label/Label.tsx +++ b/src/components/Common/BottleLetter/Label/Label.tsx @@ -4,13 +4,11 @@ import { LabelProps } from '@/types/label'; export const Label = ({ imgSrc, isActive }: LabelProps) => { return (
- +
); }; diff --git a/src/components/Common/KeywordToggleButton/KeywordToggleButton.tsx b/src/components/Common/KeywordToggleButton/KeywordToggleButton.tsx index 12aafe1e..74975152 100644 --- a/src/components/Common/KeywordToggleButton/KeywordToggleButton.tsx +++ b/src/components/Common/KeywordToggleButton/KeywordToggleButton.tsx @@ -12,7 +12,7 @@ export const KeywordToggleButton = ({ return ( diff --git a/src/components/Letter/CreateButton/CreateButton.stories.tsx b/src/components/Letter/CreateButton/CreateButton.stories.tsx index 32d79574..44af7916 100644 --- a/src/components/Letter/CreateButton/CreateButton.stories.tsx +++ b/src/components/Letter/CreateButton/CreateButton.stories.tsx @@ -6,14 +6,33 @@ const meta: Meta = { component: CreateButton, title: 'CreateButton', tags: ['autodocs'], - argTypes: {} + argTypes: {}, + decorators: [ + (Story) => ( +
+ +
+ ) + ] }; export default meta; type Story = StoryObj; -export const Default: Story = { +export const Active: Story = { args: { + children: '활성', + isActive: true, + handleClickHandler: () => { + alert('즐겁다'); + } + } +}; + +export const NonActive: Story = { + args: { + children: '비활성', + isActive: false, handleClickHandler: () => { alert('즐겁다'); } diff --git a/src/components/Letter/CreateButton/CreateButton.tsx b/src/components/Letter/CreateButton/CreateButton.tsx index 7c9c58bb..6b07ac2e 100644 --- a/src/components/Letter/CreateButton/CreateButton.tsx +++ b/src/components/Letter/CreateButton/CreateButton.tsx @@ -1,11 +1,13 @@ -import React from 'react'; +import React, { ReactNode } from 'react'; type CreateButtonProps = { + children: ReactNode; isActive: boolean; handleClickHandler: () => void; }; export const CreateButton = ({ + children, isActive, handleClickHandler }: CreateButtonProps) => { @@ -17,14 +19,11 @@ export const CreateButton = ({
); diff --git a/src/components/Letter/KeywordList/KeywordList.tsx b/src/components/Letter/KeywordList/KeywordList.tsx index 0f8e2905..62a33cee 100644 --- a/src/components/Letter/KeywordList/KeywordList.tsx +++ b/src/components/Letter/KeywordList/KeywordList.tsx @@ -6,7 +6,7 @@ export type KeywordListProps = { title: string; subTitle: string; keywordGroup: KeywordProps[]; - selectedKeywords: number[]; + selectedKeywords: number | null; onKeywordSelect: (index: number) => void; }; @@ -31,7 +31,7 @@ export const KeywordList = ({ > ))} diff --git a/src/components/Letter/LabelList/LabelList.tsx b/src/components/Letter/LabelList/LabelList.tsx index 4a93e0ab..ab9c75d9 100644 --- a/src/components/Letter/LabelList/LabelList.tsx +++ b/src/components/Letter/LabelList/LabelList.tsx @@ -4,7 +4,7 @@ import { Label } from '@/components/Common/BottleLetter/Label/Label'; type LableListProps = { labels: LabelProps[]; - selectedLabels: number[]; + selectedLabels: number | null; onLabelSelect: (index: number) => void; }; @@ -14,7 +14,7 @@ export const LabelList = ({ onLabelSelect }: LableListProps) => { return ( -
+
{labels.map((label, idx) => (
))} diff --git a/src/components/Letter/SelectItem/SelectItem.tsx b/src/components/Letter/SelectItem/SelectItem.tsx index 7f61bf27..00e892ab 100644 --- a/src/components/Letter/SelectItem/SelectItem.tsx +++ b/src/components/Letter/SelectItem/SelectItem.tsx @@ -14,35 +14,27 @@ type SelectItemProps = { export const SelectItem = ({ isActive, setIsActive }: SelectItemProps) => { const [isLabel, setIsLabel] = useState(true); - const [selectedLabels, setSelectedLabels] = useState([]); - const [selectedKeywords, setSelectedKeywords] = useState([]); + const [selectedLabels, setSelectedLabels] = useState(null); + const [selectedKeywords, setSelectedKeywords] = useState( + null + ); const navigate = useNavigate(); useEffect(() => { - if (selectedLabels.length > 0 && selectedKeywords.length > 0) { + if (selectedLabels && selectedKeywords) { setIsActive(true); } else { setIsActive(false); } }, [selectedLabels, selectedKeywords]); - // 라벨 선택 핸들러 const handleLabelSelection = (label: number) => { - setSelectedLabels((prev) => - prev.includes(label) - ? prev.filter((l) => l !== label) - : [...prev, label] - ); + setSelectedLabels(label); }; - // 키워드 선택 핸들러 const handleKeywordSelection = (keyword: number) => { - setSelectedKeywords((prev) => - prev.includes(keyword) - ? prev.filter((k) => k !== keyword) - : [...prev, keyword] - ); + setSelectedKeywords(keyword); }; const testLable: LabelProps[] = [ @@ -80,15 +72,24 @@ export const SelectItem = ({ isActive, setIsActive }: SelectItemProps) => { return (
[ - window.innerHeight * 0.08, - window.innerHeight * 0.6 - ]} + snapPoints={() => [80, window.innerHeight * 0.6]} + header={ + { + if (isActive) { + navigate('/letter/success'); + } + }} + > + {'보내기'} + + } >
{ )} -
- { - if (isActive) { - navigate('/letter/success'); - } - }} - /> -
); }; diff --git a/src/components/Letter/SuccessModal/SuccessModal.tsx b/src/components/Letter/SuccessModal/SuccessModal.tsx index 6a2e8b34..fe421078 100644 --- a/src/components/Letter/SuccessModal/SuccessModal.tsx +++ b/src/components/Letter/SuccessModal/SuccessModal.tsx @@ -3,7 +3,7 @@ import React from 'react'; export const SuccessModal = () => { return ( -
+
성공적으로 diff --git a/src/pages/Letter/Success/SuccessLetterPage.tsx b/src/pages/Letter/Success/SuccessLetterPage.tsx index 72a9ab00..c52f3c97 100644 --- a/src/pages/Letter/Success/SuccessLetterPage.tsx +++ b/src/pages/Letter/Success/SuccessLetterPage.tsx @@ -1,4 +1,3 @@ -import { Margin } from '@/components/Common/Margin/Margin'; import { CreateButton } from '@/components/Letter/CreateButton/CreateButton'; import { SuccessModal } from '@/components/Letter/SuccessModal/SuccessModal'; import React from 'react'; @@ -11,11 +10,16 @@ export const SuccessLetterPage = () => { navigate('/'); }; return ( -
- - - - +
+
+ +
+ +
+ + {'확인'} + +
); }; diff --git a/tailwind.config.js b/tailwind.config.js index 20d35bf2..ab874525 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -5,7 +5,14 @@ export default { extend: { colors: { primary: '#D1D5DB', - sample: { blue: '#22B8EF', gray: '#F5F3F1', black: '#5C5C5C' } + sample: { + blue: '#22B8EF', + gray: '#F5F3F1', + black: '#5C5C5C', + hoverblue: '#1882A8', + textgray: '#C3C3C3', + select: '#22ABEF' + } }, maxWidth: { DEFAULT: '768px'