Skip to content

Commit 805eb1e

Browse files
committed
Add confirm button to SelectOption
1 parent f0366ce commit 805eb1e

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

packages/components/src/components/Select/Select.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function ControlledCheckbox() {
6969
return (
7070
<Select onValueChange={handleChange} type="checkbox" value={value}>
7171
<SelectTrigger>Select {value}</SelectTrigger>
72-
<SelectContainer>
72+
<SelectContainer showConfirmButton>
7373
<SelectOption value="Option 1">Option 1</SelectOption>
7474
<SelectOption value="Option 2">Option 2</SelectOption>
7575
<SelectDivider />

packages/components/src/components/Select/index.tsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,15 @@ export function SelectTrigger({
197197
)
198198
}
199199

200-
export function SelectContainer({ children, ...props }: ComponentProps<'div'>) {
201-
const { open } = useSelect()
200+
interface SelectContainerProps extends ComponentProps<'div'> {
201+
showConfirmButton?: boolean
202+
}
203+
export function SelectContainer({
204+
children,
205+
showConfirmButton,
206+
...props
207+
}: SelectContainerProps) {
208+
const { open, setOpen, type } = useSelect()
202209

203210
if (!open) return null
204211
return (
@@ -220,6 +227,26 @@ export function SelectContainer({ children, ...props }: ComponentProps<'div'>) {
220227
{...props}
221228
>
222229
{children}
230+
{showConfirmButton && type === 'checkbox' && (
231+
<Flex justifyContent="end" w="100%">
232+
<Button
233+
className={css({
234+
textAlign: 'end',
235+
bg: 'var(--primary, light-dark(#674DC7, #8163E1))',
236+
borderRadius: '8px',
237+
w: 'fit-content',
238+
px: '30px',
239+
py: '10px',
240+
color: 'var(--white, light-dark(#FFF,#FFF))',
241+
typography: 'buttonS',
242+
})}
243+
onClick={() => setOpen(false)}
244+
variant="primary"
245+
>
246+
완료
247+
</Button>
248+
</Flex>
249+
)}
223250
</VStack>
224251
)
225252
}

0 commit comments

Comments
 (0)