File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type { PopupState } from '@shared/hooks/useCategoryPopups';
55interface Props {
66 popup : PopupState ;
77 onClose : ( ) => void ;
8+ onChange ?: ( value : string ) => void ;
89 onCreateConfirm ?: ( ) => void ;
910 onEditConfirm ?: ( id : number , draft ?: string ) => void ;
1011 onDeleteConfirm ?: ( id : number ) => void ;
@@ -13,6 +14,7 @@ interface Props {
1314export default function PopupPortal ( {
1415 popup,
1516 onClose,
17+ onChange,
1618 onCreateConfirm,
1719 onEditConfirm,
1820 onDeleteConfirm,
@@ -29,6 +31,7 @@ export default function PopupPortal({
2931 title = "카테고리 추가하기"
3032 left = "취소"
3133 right = "추가"
34+ onInputChange = { onChange }
3235 placeholder = "카테고리 제목을 입력해주세요"
3336 onLeftClick = { onClose }
3437 onRightClick = { ( ) => onCreateConfirm ?.( ) }
Original file line number Diff line number Diff line change @@ -11,8 +11,12 @@ import { useCategoryPopups } from '@shared/hooks/useCategoryPopups';
1111import OptionsMenuPortal from './OptionsMenuPortal' ;
1212import PopupPortal from './PopupPortal' ;
1313import { useGetDashboardCategories } from '@shared/components/sidebar/apis/queries' ;
14+ import { useState } from 'react' ;
1415
1516export function Sidebar ( ) {
17+ const [ newCategoryName , setNewCategoryName ] = useState ( '' ) ;
18+ console . log ( newCategoryName ) ; // 임시 로그
19+
1620 const { data : categories } = useGetDashboardCategories ( ) ;
1721 const {
1822 activeTab,
@@ -39,6 +43,10 @@ export function Sidebar() {
3943 categories ?. categories . find ( ( category ) => category . categoryId === id )
4044 ?. categoryName ?? '' ;
4145
46+ const handleCategoryChange = ( name : string ) => {
47+ setNewCategoryName ( name ) ;
48+ } ;
49+
4250 return (
4351 < aside className = "bg-white-bg sticky top-0 h-screen w-[24rem] border-r border-gray-300" >
4452 < div className = "flex h-full flex-col px-[0.8rem]" >
@@ -122,6 +130,7 @@ export function Sidebar() {
122130 < PopupPortal
123131 popup = { popup }
124132 onClose = { close }
133+ onChange = { handleCategoryChange }
125134 onCreateConfirm = { ( ) => {
126135 // TODO: 생성 API
127136 close ( ) ;
You can’t perform that action at this time.
0 commit comments