Skip to content

Commit b8c7630

Browse files
feat: popportal에 onChange interface 추가 및 inputChange 연결
1 parent 5191236 commit b8c7630

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

apps/client/src/shared/components/sidebar/PopupPortal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { PopupState } from '@shared/hooks/useCategoryPopups';
55
interface 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 {
1314
export 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?.()}

apps/client/src/shared/components/sidebar/Sidebar.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ import { useCategoryPopups } from '@shared/hooks/useCategoryPopups';
1111
import OptionsMenuPortal from './OptionsMenuPortal';
1212
import PopupPortal from './PopupPortal';
1313
import { useGetDashboardCategories } from '@shared/components/sidebar/apis/queries';
14+
import { useState } from 'react';
1415

1516
export 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();

0 commit comments

Comments
 (0)