1- import styled , { keyframes , css } from 'styled-components' ;
1+ import styled from 'styled-components' ;
22
33export const BottomSheetWrapper = styled . div < { $isOpenBottomSheet : boolean } > `
44 position: fixed;
@@ -8,21 +8,18 @@ export const BottomSheetWrapper = styled.div<{ $isOpenBottomSheet: boolean }>`
88 height: 100%;
99 z-index: 999;
1010 background-color: rgba(0, 0, 0, 0.3);
11- animation: ${ ( props ) =>
12- props . $isOpenBottomSheet
13- ? css `
14- ${ fadeIn } 0.2s ease-out forwards
15- `
16- : css `
17- ${ fadeOut } 0.2s ease-out forwards
18- ` } ;
11+ opacity: ${ ( { $isOpenBottomSheet } ) => ( $isOpenBottomSheet ? 1 : 0 ) } ;
12+ visibility: ${ ( { $isOpenBottomSheet } ) => ( $isOpenBottomSheet ? 'visible' : 'hidden' ) } ;
13+ transition:
14+ opacity 0.2s ease-out,
15+ visibility 0.2s ease-out;
1916` ;
2017
21- export const BottomSheetLayout = styled . div . attrs < { $currentTranslateY : number } > ( ( { $currentTranslateY } ) => ( {
22- style : {
23- transform : `translate(-50%, ${ $ currentTranslateY} px)` ,
24- } ,
25- } ) ) < { $isOpenBottomSheet : boolean ; $currentTranslateY : number ; $isHandlerVisible : boolean } > `
18+ export const BottomSheetLayout = styled . div < {
19+ $isOpenBottomSheet : boolean ;
20+ $ currentTranslateY: number ;
21+ $isHandlerVisible : boolean ;
22+ } > `
2623 position: fixed;
2724 bottom: 0;
2825 flex-direction: column;
@@ -31,18 +28,15 @@ export const BottomSheetLayout = styled.div.attrs<{ $currentTranslateY: number }
3128 left: 50%;
3229 border-radius: 0.938rem 0.938rem 0 0;
3330 background-color: ${ ( { theme } ) => theme . colors . white } ;
34- padding-top: ${ ( props ) => ( props . $isHandlerVisible ? '1.3rem' : '0.9375rem' ) } ;
31+ padding-top: ${ ( { $isHandlerVisible } ) => ( $isHandlerVisible ? '1.3rem' : '0.9375rem' ) } ;
3532 z-index: 200;
3633 user-select: none;
3734 touch-action: none;
38- animation: ${ ( props ) =>
39- props . $isOpenBottomSheet
40- ? css `
41- ${ slideUp } 0.2s ease-out
42- `
43- : css `
44- ${ slideDown } 0.2s ease-out forwards
45- ` } ;
35+ transform: translate(
36+ -50%,
37+ ${ ( { $currentTranslateY, $isOpenBottomSheet } ) => ( $isOpenBottomSheet ? `${ $currentTranslateY } px` : '100%' ) }
38+ );
39+ transition: transform 0.3s ease-in-out;
4640` ;
4741
4842export const Handler = styled . hr `
@@ -55,39 +49,3 @@ export const Handler = styled.hr`
5549 z-index: 300;
5650 cursor: pointer;
5751` ;
58-
59- const fadeIn = keyframes `
60- from {
61- opacity: 0;
62- }
63- to {
64- opacity: 1;
65- }
66- ` ;
67-
68- const fadeOut = keyframes `
69- from {
70- opacity: 1;
71- visibility: visible;
72- }
73- to {
74- opacity: 0;
75- visibility: hidden;
76- }
77- ` ;
78-
79- const slideUp = keyframes `
80- from {
81- transform: translate(-50%, 100%);
82- }
83- to {
84- transform: translate(-50%, 0);
85- }
86- ` ;
87-
88- const slideDown = keyframes `
89- to {
90- transform: translate(-50%, 100%);
91- visibility: hidden;
92- }
93- ` ;
0 commit comments