diff --git a/apps/docs/src/App.tsx b/apps/docs/src/App.tsx index 8054a7d..bdafc9d 100644 --- a/apps/docs/src/App.tsx +++ b/apps/docs/src/App.tsx @@ -4,7 +4,7 @@ import { ChangeEvent, useState } from 'react'; import '@sopt-makers/ui/dist/index.css'; -import { FieldBox, SearchField, Test, TextArea, TextField } from '@sopt-makers/ui'; +import { FieldBox, SearchField, Test, TextArea, TextField, SelectV2 } from '@sopt-makers/ui'; import { colors } from '@sopt-makers/colors'; function App() { @@ -46,6 +46,11 @@ function App() { setSearch(''); }; + const options = [ + { label: 'Option 1', value: 'option1' }, + { label: 'Option 2', value: 'option2' }, + ]; + return ( <> @@ -88,6 +93,30 @@ function App() { > 여긴 본문 +
+ { + console.log('dsad'); + }} + type='text' + > + + + + + {options.map((option) => ( + { + console.log('custom logic'); + }} + /> + ))} + + +
); } diff --git a/packages/ui/Input/Select.tsx b/packages/ui/Input/Select.tsx index 8cb7d46..1e964b6 100644 --- a/packages/ui/Input/Select.tsx +++ b/packages/ui/Input/Select.tsx @@ -144,18 +144,18 @@ function SelectTrigger({ children }: SelectTriggerProps) { } interface SelectTriggerContentProps { - className?: string; placeholder?: string; + className?: string; } // Select.TriggerContent 컴포넌트: trigger의 미리 정의된 UI -function SelectTriggerContent({ className, placeholder }: SelectTriggerContentProps) { +function SelectTriggerContent({ placeholder, className }: SelectTriggerContentProps) { const { open, selected } = useSelectContext(); const selectedLabel = selected ? selected.label : placeholder; return ( -
+

{selectedLabel}

+
    {children}
); @@ -191,10 +192,11 @@ function SelectMenu({ children }: SelectMenuProps) { interface SelectMenuItemProps { option: Option; onClick?: () => void; + className?: string; } // SelectMenuItem 컴포넌트: 옵션 목록 하나의 UI -function SelectMenuItem({ option, onClick }: SelectMenuItemProps) { +function SelectMenuItem({ option, onClick, className }: SelectMenuItemProps) { const { open, type, handleOptionClick } = useSelectContext(); const handleClick = () => { @@ -211,7 +213,7 @@ function SelectMenuItem({ option, onClick }: SelectMenuItemProps) { return (
  • -