From f05dd88369188a9cc3db25b28231af7c4dc6ca70 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 6 Feb 2025 16:07:48 -0800 Subject: [PATCH] Add Storybook story --- webview-ui/src/index.css | 8 ++ webview-ui/src/stories/Combobox.stories.tsx | 99 +++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 webview-ui/src/stories/Combobox.stories.tsx diff --git a/webview-ui/src/index.css b/webview-ui/src/index.css index 194f421684..5c10182c22 100644 --- a/webview-ui/src/index.css +++ b/webview-ui/src/index.css @@ -289,3 +289,11 @@ vscode-dropdown::part(listbox) { .vscrui-checkbox__listbox > ul { max-height: unset !important; } + +/** + * @shadcn/ui Overrides / Hacks + */ + +input[cmdk-input]:focus { + outline: none; +} diff --git a/webview-ui/src/stories/Combobox.stories.tsx b/webview-ui/src/stories/Combobox.stories.tsx new file mode 100644 index 0000000000..6a0e6f08d5 --- /dev/null +++ b/webview-ui/src/stories/Combobox.stories.tsx @@ -0,0 +1,99 @@ +import { useState } from "react" +import type { Meta, StoryObj } from "@storybook/react" +import { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons" + +import { cn } from "@/lib/utils" +import { + Button, + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui" + +const meta = { + title: "@shadcn/Combobox", + component: Combobox, + parameters: { layout: "centered" }, + tags: ["autodocs"], +} satisfies Meta + +export default meta + +type Story = StoryObj + +export const Default: Story = { + name: "Combobox", + render: () => , +} + +const frameworks = [ + { + value: "next.js", + label: "Next.js", + }, + { + value: "sveltekit", + label: "SvelteKit", + }, + { + value: "nuxt.js", + label: "Nuxt.js", + }, + { + value: "remix", + label: "Remix", + }, + { + value: "astro", + label: "Astro", + }, +] + +function Combobox() { + const [open, setOpen] = useState(false) + const [value, setValue] = useState("") + + return ( + + + + + + + + + No framework found. + + {frameworks.map((framework) => ( + { + setValue(currentValue === value ? "" : currentValue) + setOpen(false) + }}> + {framework.label} + + + ))} + + + + + + ) +}