From e934127ad4ae3621c731528951ae36f23fed7450 Mon Sep 17 00:00:00 2001 From: wuzoo Date: Fri, 13 Dec 2024 00:38:50 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20intro=20part=20org=20root=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B4=80=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/OrgAdmin/HomeSection/HomeSection.tsx | 16 ++++++++-- .../OrgAdmin/HomeSection/PartIntroSection.tsx | 29 +++++++++++-------- .../org/OrgAdmin/HomeSection/constant.ts | 2 +- src/components/org/OrgAdmin/index.tsx | 19 +++++++++--- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/components/org/OrgAdmin/HomeSection/HomeSection.tsx b/src/components/org/OrgAdmin/HomeSection/HomeSection.tsx index 9e9ede7..793ff6c 100644 --- a/src/components/org/OrgAdmin/HomeSection/HomeSection.tsx +++ b/src/components/org/OrgAdmin/HomeSection/HomeSection.tsx @@ -7,15 +7,27 @@ import { StContainer, StWrapper, } from '@/components/org/OrgAdmin/HomeSection/style'; +import { PART_KO } from '@/utils/org'; -const HomeSection = () => { +type HomeSectionProps = { + selectedIntroPart: PART_KO; + onChangeIntroPart: (part: PART_KO) => void; +}; + +const HomeSection = ({ + selectedIntroPart, + onChangeIntroPart, +}: HomeSectionProps) => { const { data } = useAdminInfoQuery(); return ( - + diff --git a/src/components/org/OrgAdmin/HomeSection/PartIntroSection.tsx b/src/components/org/OrgAdmin/HomeSection/PartIntroSection.tsx index 03d5ab3..9397d4b 100644 --- a/src/components/org/OrgAdmin/HomeSection/PartIntroSection.tsx +++ b/src/components/org/OrgAdmin/HomeSection/PartIntroSection.tsx @@ -2,7 +2,6 @@ import { IconInfoCircle } from '@sopt-makers/icons'; import { Chip, TextArea } from '@sopt-makers/ui'; -import { useState } from 'react'; import { useFormContext } from 'react-hook-form'; import { PARTS } from '@/components/org/OrgAdmin/HomeSection/constant'; @@ -14,15 +13,21 @@ import { StTextAreaContainer, StTitleWithIcon, } from '@/components/org/OrgAdmin/HomeSection/style'; +import { PART_KO } from '@/utils/org'; import RequiredIcon from '../assets/RequiredIcon'; import Modal from '../common/Modal'; import useModal from '../common/Modal/useModal'; -type Part = '기획' | '디자인' | '안드로이드' | 'IOS' | '웹' | '서버'; +type PartIntroSectionProps = { + selectedPart: PART_KO; + onChangePart: (id: PART_KO) => void; +}; -const PartIntroSection = () => { - const [selectedChip, setSelectedChip] = useState('기획'); +const PartIntroSection = ({ + selectedPart, + onChangePart, +}: PartIntroSectionProps) => { const { isInfoVisible, onInfoToggle } = useModal(); const { @@ -33,10 +38,10 @@ const PartIntroSection = () => { formState: { errors }, } = useFormContext(); - const getActiveStatus = (id: Part) => id === selectedChip; + const getActiveStatus = (id: PART_KO) => id === selectedPart; - const handleSelectChip = (id: Part) => { - setSelectedChip(id); + const handleSelectChip = (id: PART_KO) => { + onChangePart(id); }; const handleValidation = (field: string, value: string) => { @@ -75,19 +80,19 @@ const PartIntroSection = () => {