1 import type { Meta, StoryObj } from "@storybook/react"
2 import * as React from "react"
3
4 import { Button } from "../button"
5 import { CommandBar } from "./command-bar"
6
7 const meta: Meta<typeof CommandBar> = {
8 title: "Components/CommandBar",
9 component: CommandBar,
10 parameters: {
11 layout: "fullscreen",
12 },
13 }
14
15 export default meta
16
17 type Story = StoryObj<typeof CommandBar>
18
19 const CommandBarDemo = () => {
20 const [active, setActive] = React.useState(false)
21
22 return (
23 <div className="flex h-screen w-screen items-center justify-center">
24 <Button onClick={() => setActive(!active)}>
25 {active ? "Hide" : "Show"}
26 </Button>
27 <CommandBar open={active}>
28 <CommandBar.Bar>
29 <CommandBar.Value>1 selected</CommandBar.Value>
30 <CommandBar.Seperator />
31 <CommandBar.Command
32 label="Edit"
33 action={() => {
34 console.log("Edit")
35 }}
36 shortcut="e"
37 />
38 <CommandBar.Seperator />
39 <CommandBar.Command
40 label="Delete"
41 action={() => {
42 console.log("Delete")
43 }}
44 shortcut="d"
45 />
46 </CommandBar.Bar>
47 </CommandBar>
48 </div>
49 )
50 }
51
52 export const Default: Story = {
53 render: () => <CommandBarDemo />,
54 }