File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,17 +16,56 @@ import { Text } from '../Typography';
1616### Usage
1717
1818<Playground >
19- <Drawer
20- space = " 30%"
21- isVisible = { false }
22- onClose = { () => console .log (' Close' )}
23- offset = { 0 }
24- position = " left"
25- getStyles = { (props , theme ) => ({
26- modalContainerStyle: {},
27- containerStyle: {},
28- })}
29- />
19+ <Drawer />
20+ <Toggle >
21+ { ({ on , toggle }) => (
22+ <>
23+ <Button onPress = { toggle } isInline title = " Open drawer menu" />
24+ <Drawer
25+ space = { null } // px or %, null fits the content
26+ offset = { 0 }
27+ position = " bottom"
28+ isVisible = { on }
29+ onClose = { toggle }
30+ getStyles = { (props , theme ) => ({
31+ modalContainerStyle: {},
32+ containerStyle: {},
33+ })}
34+ >
35+ <Spacing padding = { 3 } >
36+ <Box elevation = { 1 } backgroundColor = " white" borderRadius = { 4 } >
37+ { [
38+ {
39+ onPress: toggle ,
40+ title: ' Menu Option 1' ,
41+ color: ' danger' ,
42+ },
43+ {
44+ onPress: toggle ,
45+ title: ' Menu Option 2' ,
46+ color: ' primary' ,
47+ },
48+ {
49+ onPress: toggle ,
50+ title: ' Menu Option 3' ,
51+ color: ' secondary' ,
52+ },
53+ {
54+ onPress: toggle ,
55+ title: ' Menu Option 4' ,
56+ },
57+ ].map (option => (
58+ <Button key = { option .title } appearance = " minimal" { ... option } />
59+ ))}
60+ </Box >
61+ <Spacing paddingTop = { 3 } >
62+ <Button onPress = { toggle } title = " Close" />
63+ </Spacing >
64+ </Spacing >
65+ </Drawer >
66+ </>
67+ )}
68+ </Toggle >
3069</Playground >
3170
3271### Variants
Original file line number Diff line number Diff line change @@ -50,12 +50,6 @@ export const Drawer = (props: DrawerProps) => {
5050 ) ( theme ) ;
5151
5252 const animation = useSpring ( {
53- config : {
54- clamp : true ,
55- friction : 24 ,
56- tension : 240 ,
57- } ,
58-
5953 [ position ] : offset ,
6054 from : { [ position ] : - 600 } ,
6155 reset : true ,
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -65,11 +65,6 @@ export const ModalBase = (props: ModalBaseProps): React.ReactPortal | null => {
6565 } , [ visible ] ) ;
6666
6767 const { opacity, y } = useSpring ( {
68- config : {
69- clamp : true ,
70- friction : 24 ,
71- tension : 240 ,
72- } ,
7368 onRest : ( ) => {
7469 if ( ! visible ) setIsInView ( false ) ;
7570 } ,
You can’t perform that action at this time.
0 commit comments