/
drawer.backdrop.tsx
170 lines (160 loc) · 5.59 KB
/
drawer.backdrop.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
"use client";
import { Button, Drawer, Sidebar, TextInput } from "flowbite-react";
import { useState } from "react";
import {
HiChartPie,
HiClipboard,
HiCollection,
HiInformationCircle,
HiLogin,
HiPencil,
HiSearch,
HiShoppingBag,
HiUsers,
} from "react-icons/hi";
import type { CodeData } from "~/components/code-demo";
const code = `
"use client";
import { Button, Drawer, Sidebar, TextInput } from "flowbite-react";
import { useState } from "react";
import {
HiChartPie,
HiClipboard,
HiCollection,
HiInformationCircle,
HiLogin,
HiPencil,
HiSearch,
HiShoppingBag,
HiUsers,
} from "react-icons/hi";
export function Component() {
const [isOpen, setIsOpen] = useState(true);
const handleClose = () => setIsOpen(false);
return (
<>
<div className="flex min-h-[50vh] items-center justify-center">
<Button onClick={() => setIsOpen(true)}>Show navigation</Button>
</div>
<Drawer open={isOpen} onClose={handleClose}>
<Drawer.Header title="MENU" titleIcon={() => <></>} />
<Drawer.Items>
<Sidebar
aria-label="Sidebar with multi-level dropdown example"
className="[&>div]:bg-transparent [&>div]:p-0"
>
<div className="flex h-full flex-col justify-between py-2">
<div>
<form className="pb-3 md:hidden">
<TextInput icon={HiSearch} type="search" placeholder="Search" required size={32} />
</form>
<Sidebar.Items>
<Sidebar.ItemGroup>
<Sidebar.Item href="/" icon={HiChartPie}>
Dashboard
</Sidebar.Item>
<Sidebar.Item href="/e-commerce/products" icon={HiShoppingBag}>
Products
</Sidebar.Item>
<Sidebar.Item href="/users/list" icon={HiUsers}>
Users list
</Sidebar.Item>
<Sidebar.Item href="/authentication/sign-in" icon={HiLogin}>
Sign in
</Sidebar.Item>
<Sidebar.Item href="/authentication/sign-up" icon={HiPencil}>
Sign up
</Sidebar.Item>
</Sidebar.ItemGroup>
<Sidebar.ItemGroup>
<Sidebar.Item href="https://github.com/themesberg/flowbite-react/" icon={HiClipboard}>
Docs
</Sidebar.Item>
<Sidebar.Item href="https://flowbite-react.com/" icon={HiCollection}>
Components
</Sidebar.Item>
<Sidebar.Item href="https://github.com/themesberg/flowbite-react/issues" icon={HiInformationCircle}>
Help
</Sidebar.Item>
</Sidebar.ItemGroup>
</Sidebar.Items>
</div>
</div>
</Sidebar>
</Drawer.Items>
</Drawer>
</>
);
}
`;
export function Component() {
const [isOpen, setIsOpen] = useState(true);
const handleClose = () => setIsOpen(false);
return (
<>
<div className="flex min-h-[50vh] items-center justify-center">
<Button onClick={() => setIsOpen(true)}>Show navigation</Button>
</div>
<Drawer open={isOpen} onClose={handleClose}>
<Drawer.Header title="MENU" titleIcon={() => <></>} />
<Drawer.Items>
<Sidebar
aria-label="Sidebar with multi-level dropdown example"
className="[&>div]:bg-transparent [&>div]:p-0"
>
<div className="flex h-full flex-col justify-between py-2">
<div>
<form className="pb-3 md:hidden">
<TextInput icon={HiSearch} type="search" placeholder="Search" required size={32} />
</form>
<Sidebar.Items>
<Sidebar.ItemGroup>
<Sidebar.Item href="/" icon={HiChartPie}>
Dashboard
</Sidebar.Item>
<Sidebar.Item href="/e-commerce/products" icon={HiShoppingBag}>
Products
</Sidebar.Item>
<Sidebar.Item href="/users/list" icon={HiUsers}>
Users list
</Sidebar.Item>
<Sidebar.Item href="/authentication/sign-in" icon={HiLogin}>
Sign in
</Sidebar.Item>
<Sidebar.Item href="/authentication/sign-up" icon={HiPencil}>
Sign up
</Sidebar.Item>
</Sidebar.ItemGroup>
<Sidebar.ItemGroup>
<Sidebar.Item href="https://github.com/themesberg/flowbite-react/" icon={HiClipboard}>
Docs
</Sidebar.Item>
<Sidebar.Item href="https://flowbite-react.com/" icon={HiCollection}>
Components
</Sidebar.Item>
<Sidebar.Item href="https://github.com/themesberg/flowbite-react/issues" icon={HiInformationCircle}>
Help
</Sidebar.Item>
</Sidebar.ItemGroup>
</Sidebar.Items>
</div>
</div>
</Sidebar>
</Drawer.Items>
</Drawer>
</>
);
}
export const backdrop: CodeData = {
type: "single",
code: [
{
fileName: "client",
language: "tsx",
code,
},
],
githubSlug: "drawer/drawer.backdrop.tsx",
component: <Component />,
iframe: 600,
};