Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 56 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Demo, SelectProp } from "@cianciarusocataldo/demo-ui"; |
||
2 | |||
3 | import { Button, Drawer } from "modular-ui-preview"; |
||
4 | import { ComponentPage } from "app/components/ComponentPage"; |
||
5 | import { DEMO_COMMON_PROPS } from "app/constants/demo-props"; |
||
6 | import React from "react"; |
||
7 | |||
8 | const DrawerPage = () => { |
||
9 | const [isVisible, setVisible] = React.useState(false); |
||
10 | |||
11 | let demoProps = { ...DEMO_COMMON_PROPS }; |
||
12 | delete demoProps.hide; |
||
13 | |||
14 | return ( |
||
15 | <ComponentPage |
||
16 | name="Drawer" |
||
17 | render={(t) => ( |
||
18 | <Demo |
||
19 | label="Drawer" |
||
20 | startColor="#C3BBBB" |
||
21 | props={{ |
||
22 | position: SelectProp({ |
||
23 | top: "top", |
||
24 | "top-left": "top-left", |
||
25 | "top-right": "top-right", |
||
26 | bottom: "bottom", |
||
27 | "bottom-left": "bottom-left", |
||
28 | "bottom-right": "bottom-right", |
||
29 | left: "left", |
||
30 | right: "right", |
||
31 | }), |
||
32 | ...demoProps, |
||
33 | }} |
||
34 | > |
||
35 | {(props: any) => { |
||
36 | return ( |
||
37 | <div className="flex flex-col items-center"> |
||
38 | <Button onClick={() => setVisible(!isVisible)}> |
||
39 | {t(isVisible ? "common_close" : "common_open")} |
||
40 | </Button> |
||
41 | <Drawer |
||
42 | hide={!isVisible} |
||
43 | onClose={() => setVisible(false)} |
||
44 | {...props} |
||
45 | /> |
||
46 | </div> |
||
47 | ); |
||
48 | }} |
||
49 | </Demo> |
||
50 | )} |
||
51 | /> |
||
52 | ); |
||
53 | }; |
||
54 | |||
55 | export default DrawerPage; |
||
56 |