File tree Expand file tree Collapse file tree
src/shared/ui/bottom-sheet Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { Meta , StoryObj } from '@storybook/nextjs-vite' ;
2+ import { useState } from 'react' ;
3+
4+ import BottomSheet from './BottomSheet' ;
5+
6+ const meta : Meta < typeof BottomSheet > = {
7+ title : 'Shared/UI/BottomSheet' ,
8+ component : BottomSheet ,
9+ parameters : {
10+ layout : 'fullscreen' ,
11+ } ,
12+ tags : [ 'autodocs' ] ,
13+ } ;
14+
15+ export default meta ;
16+ type Story = StoryObj < typeof BottomSheet > ;
17+
18+ const BottomSheetWithHooks = ( ) => {
19+ const [ isOpen , setIsOpen ] = useState ( false ) ;
20+
21+ return (
22+ < div className = 'flex h-screen w-full items-center justify-center bg-gray-100 p-4' >
23+ < button
24+ className = 'rounded bg-blue-500 px-4 py-2 font-bold text-white hover:bg-blue-700'
25+ onClick = { ( ) => setIsOpen ( true ) }
26+ >
27+ Open BottomSheet
28+ </ button >
29+ { isOpen && (
30+ < BottomSheet onClose = { ( ) => setIsOpen ( false ) } >
31+ < div className = 'px-5' >
32+ < h2 className = 'text-title-2 text-text-primary mb-2' >
33+ Bottom Sheet Title
34+ </ h2 >
35+ < p className = 'text-body-2 text-text-secondary' >
36+ Here is some content inside the bottom sheet. You can put anything
37+ here.
38+ </ p >
39+ < div className = 'mt-4 flex flex-col gap-2' >
40+ < button className = 'bg-primary-default w-full rounded py-3 font-medium text-white' >
41+ Confirm
42+ </ button >
43+ < button
44+ className = 'text-text-secondary w-full rounded bg-gray-100 py-3 font-medium'
45+ onClick = { ( ) => setIsOpen ( false ) }
46+ >
47+ Cancel
48+ </ button >
49+ </ div >
50+ </ div >
51+ </ BottomSheet >
52+ ) }
53+ </ div >
54+ ) ;
55+ } ;
56+
57+ export const Default : Story = {
58+ render : ( ) => < BottomSheetWithHooks /> ,
59+ } ;
Original file line number Diff line number Diff line change 1+ import type { PropsWithChildren } from 'react' ;
2+
3+ import Icon from '../icon/Icon' ;
4+
5+ interface BottomSheetProps extends PropsWithChildren {
6+ onClose : ( ) => void ;
7+ }
8+
9+ export default function BottomSheet ( { onClose, children } : BottomSheetProps ) {
10+ return (
11+ < div className = 'bg-gray-0 flex w-full flex-col rounded-t-xl pb-5 shadow-lg' >
12+ < div className = 'flex w-full justify-end pt-4 pr-5' >
13+ < button
14+ type = 'button'
15+ onClick = { onClose }
16+ className = 'text-text-primary flex h-6 w-6 items-center justify-center active:scale-95'
17+ aria-label = '닫기'
18+ >
19+ < Icon name = 'ic_menu_close' size = { 24 } />
20+ </ button >
21+ </ div >
22+ { children }
23+ </ div >
24+ ) ;
25+ }
Original file line number Diff line number Diff line change 1+ export { default as BottomSheet } from './BottomSheet' ;
You can’t perform that action at this time.
0 commit comments