diff --git a/packages/common/components/src/ui/icon-finder/index.tsx b/packages/common/components/src/ui/icon-finder/index.tsx index 62e6e195a..db8f6d1bd 100644 --- a/packages/common/components/src/ui/icon-finder/index.tsx +++ b/packages/common/components/src/ui/icon-finder/index.tsx @@ -1,19 +1,34 @@ import { useState } from "react"; -import { Button } from "../button"; -import { Dialog, DialogContent, DialogTrigger } from "../dialog"; import { cn } from "../../lib"; +import { Button } from "../button"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "../dialog"; +import { Input } from "../input"; import iconNames from "./data"; type IconFinderProps = { - handleClick: (icon: string) => void; + handleClick?: (icon: string) => void; }; const IconFinder = ({ handleClick }: IconFinderProps) => { const [selectedIcon, setSelectedIcon] = useState(""); + const [inputValue, setInputValue] = useState(""); + const [filteredIconNames, setFilteredIconNames] = useState(iconNames); const handleIconClick = (icon: string) => { setSelectedIcon(icon); - handleClick(icon); + handleClick?.(icon); + }; + + const handleInputChange = (e: React.ChangeEvent) => { + const value = e.target.value; + setInputValue(value); + setFilteredIconNames(iconNames.filter((icon) => icon.includes(value))); }; return ( @@ -24,10 +39,19 @@ const IconFinder = ({ handleClick }: IconFinderProps) => { 아이콘 찾기 - -
+ + + 아이콘 찾기 + +
+
- {iconNames.map((icon) => ( + {filteredIconNames.map((icon) => ( - - {icon} + + {icon}
); }; diff --git a/packages/common/components/src/ui/input/index.tsx b/packages/common/components/src/ui/input/index.tsx index a980f0ebd..d53c6a199 100644 --- a/packages/common/components/src/ui/input/index.tsx +++ b/packages/common/components/src/ui/input/index.tsx @@ -3,7 +3,7 @@ import * as React from "react"; import { cn } from "../../lib/utils"; const Input = React.forwardRef>( - ({ className, type, value, ...props }, ref) => { + ({ className, type, ...props }, ref) => { return ( >( "flex h-[3.2rem] w-full rounded-md border border-input bg-form px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-placeholder focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className, )} - value={value ?? ""} ref={ref} {...props} />