Skip to content

Commit

Permalink
feat: Bottom Sheet 공통 컴포넌트 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
dmswl98 committed Sep 6, 2023
1 parent 681c819 commit 5273db4
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions app/_components/common/BottomSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use client';

import Box from '@mui/material/Box';
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
import palette from '@styles/palette';
import { PropsWithChildren, useState } from 'react';
import { styled } from 'styled-components';

import Button from './Button';

const BottomSheet = ({ children }: PropsWithChildren) => {
const [isShow, setIsShow] = useState(false);

return (
<>
<Button onClick={() => setIsShow(true)}>Bottom Sheet</Button>
<SwipeableDrawer
anchor="bottom"
open={isShow}
onClose={() => setIsShow(false)}
onOpen={() => setIsShow(true)}
sx={{
'.MuiPaper-root': {
margin: '0 auto',
paddingTop: '30px',
paddingX: '20px',
maxWidth: '23.4rem',
borderTopLeftRadius: '16px',
borderTopRightRadius: '16px',
},
}}
>
<HandleBar />
{children}
</SwipeableDrawer>
</>
);
};

export default BottomSheet;

const HandleBar = styled(Box)`
width: 80px;
height: 6px;
background-color: ${palette.grey_60};
border-radius: 3px;
position: absolute;
top: 12px;
left: 50%;
transform: translateX(-50%);
`;

0 comments on commit 5273db4

Please sign in to comment.