11import styled , { css } from 'styled-components'
2- import { StyledSidePanelProps } from './types'
2+ import { StyledSidePanelProps , StyledFooterProps } from './types'
33import tw from 'twin.macro'
44
55export const StyledBackdrop = styled . div < StyledSidePanelProps > `
6- ${ ( { theme, $isOpen } ) => css `
6+ ${ ( { theme, $isOpen, $order = 0 } ) => css `
77 position : fixed;
88 top : 0 ;
99 left : 0 ;
@@ -16,7 +16,7 @@ export const StyledBackdrop = styled.div<StyledSidePanelProps>`
1616 visibility ${ theme . transition . duration . normal } ms ease-in-out;
1717 opacity : 0 ;
1818 visibility : hidden;
19- z-index : 28 ; /* just below the side panel */
19+ z-index : ${ 28 + $order } ; /* just below the side panel */
2020
2121 ${ $isOpen &&
2222 css `
@@ -28,28 +28,67 @@ export const StyledBackdrop = styled.div<StyledSidePanelProps>`
2828
2929export const StyledHeader = styled . div `
3030 ${ ( { theme } ) => css `
31- ${ tw `sticky top-0 pt-10 pb-4 ` }
31+ ${ tw `top-0 pt-10 pb-4 ` }
3232
3333 background : ${ theme . color . background } ;
3434 ` }
3535`
3636
37- export const StyledSidePanel = styled . div < StyledSidePanelProps > `
37+ export const StyledContent = styled . div `
38+ ${ tw `p-12 pb-0 flex-1` }
39+ overflow- y: auto ;
40+ `
41+
42+ export const StyledFooter = styled . div < StyledFooterProps > `
3843 ${ ( { theme, $isOpen } ) => css `
44+ ${ tw `fixed botto m-0 left-0 right-0 p-6` }
45+
46+ background: ${ theme . color . background } 99;
47+ max- height: 5.375rem;
48+
49+ ${ $isOpen &&
50+ css `
51+ animation: slideUp ${ theme . transition . duration . normal } ms
52+ ${ theme . transition . timing } for wards;
53+ ` }
54+
55+ @keyframes slideUp {
56+ from {
57+ transform : translateY (100% );
58+ opacity : 0 ;
59+ }
60+ to {
61+ transform : translateY (0 );
62+ opacity : 1 ;
63+ }
64+ }
65+ ` }
66+ `
67+
68+ export const StyledSidePanel = styled . div < StyledSidePanelProps > `
69+ ${ ( {
70+ theme,
71+ $isOpen,
72+ $order = 0 ,
73+ $width = '43rem' ,
74+ $mobileHeight = '80vh' ,
75+ } ) => css `
3976 position : fixed;
4077 background-color : ${ theme . color . background } ;
41- overflow- y: auto ;
78+ overflow : hidden;
79+ display : flex;
80+ flex-direction : column;
4281
4382 /* Desktop Styles */
4483 top : 1rem ;
4584 right : 1rem ;
4685 bottom : 1rem ;
47- width: 50vw ;
86+ width : calc( ${ $width } - ${ $order * 20 } px) ;
4887
4988 /* For sliding effect on desktop */
5089 transform : translateX (100% );
5190 transition : transform ${ theme . transition . duration . normal } ms ease-in-out;
52- z- index: 50;
91+ z-index : ${ 29 + $order * 2 } ; /* above the backdrop */
5392
5493 ${ $isOpen
5594 ? css `
@@ -65,7 +104,7 @@ export const StyledSidePanel = styled.div<StyledSidePanelProps>`
65104 bottom : 0 ;
66105 left : 0.5rem ;
67106 right : 0.5 rem;
68- height : 80 vh ;
107+ height : calc( ${ $mobileHeight } - ${ $order * 20 } px) ;
69108 width : initial;
70109 border-radius : 1.5rem 1.5rem 0 0 ;
71110
0 commit comments