|
1
|
import { Checkbox, CommandBar, Label, Text } from "@medusajs/ui" |
|
2
|
import * as React from "react" |
|
3
|
|
|
4
|
export default function CommandBarDemo() { |
|
5
|
const [selected, setSelected] = React.useState<boolean>(false) |
|
6
|
|
|
7
|
return ( |
|
8
|
<div className="flex justify-center gap-y-2 flex-col"> |
|
9
|
<div className="flex items-center gap-x-2"> |
|
10
|
<Checkbox |
|
11
|
checked={selected} |
|
12
|
onCheckedChange={(checked) => |
|
13
|
setSelected(checked === true ? true : false) |
|
14
|
} |
|
15
|
/> |
|
16
|
<Label>Item One</Label> |
|
17
|
</div> |
|
18
|
<div><Text size="small" className="text-ui-fg-muted">Check the box to view the command bar</Text></div> |
|
19
|
<CommandBar open={selected}> |
|
20
|
<CommandBar.Bar> |
|
21
|
<CommandBar.Value>1 selected</CommandBar.Value> |
|
22
|
<CommandBar.Seperator /> |
|
23
|
<CommandBar.Command |
|
24
|
action={() => { |
|
25
|
alert("Delete") |
|
26
|
}} |
|
27
|
label="Delete" |
|
28
|
shortcut="d" |
|
29
|
/> |
|
30
|
<CommandBar.Seperator /> |
|
31
|
<CommandBar.Command |
|
32
|
action={() => { |
|
33
|
alert("Edit") |
|
34
|
}} |
|
35
|
label="Edit" |
|
36
|
shortcut="e" |
|
37
|
/> |
|
38
|
</CommandBar.Bar> |
|
39
|
</CommandBar> |
|
40
|
</div> |
|
41
|
) |
|
42
|
} |