From 469f3b9c6a01858f2254db3525eec92172e25a28 Mon Sep 17 00:00:00 2001 From: Caio Alexandre Troti Caetano Date: Fri, 6 Dec 2024 11:09:57 -0300 Subject: [PATCH 1/5] :sparkles: feat: Added skeleton stories --- .../ui/{skeleton.tsx => skeleton/index.tsx} | 0 src/components/ui/skeleton/skeleton.mdx | 19 +++++++++++++ .../ui/skeleton/skeleton.stories.tsx | 27 +++++++++++++++++++ 3 files changed, 46 insertions(+) rename src/components/ui/{skeleton.tsx => skeleton/index.tsx} (100%) create mode 100644 src/components/ui/skeleton/skeleton.mdx create mode 100644 src/components/ui/skeleton/skeleton.stories.tsx diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton/index.tsx similarity index 100% rename from src/components/ui/skeleton.tsx rename to src/components/ui/skeleton/index.tsx diff --git a/src/components/ui/skeleton/skeleton.mdx b/src/components/ui/skeleton/skeleton.mdx new file mode 100644 index 00000000..bfefac92 --- /dev/null +++ b/src/components/ui/skeleton/skeleton.mdx @@ -0,0 +1,19 @@ +import { Meta, Controls, Primary, Canvas } from '@storybook/blocks' +import * as Story from './skeleton.stories' + + + +# Skeleton + +Use to show a placeholder while content is loading. + +### Primary + + + +### Example + + + + + diff --git a/src/components/ui/skeleton/skeleton.stories.tsx b/src/components/ui/skeleton/skeleton.stories.tsx new file mode 100644 index 00000000..6d93dd06 --- /dev/null +++ b/src/components/ui/skeleton/skeleton.stories.tsx @@ -0,0 +1,27 @@ +import { Meta, StoryObj } from '@storybook/react' +import { Skeleton } from '.' + +const meta: Meta> = { + title: 'Primitives/Skeleton', + component: Skeleton, + argTypes: {} +} + +export default meta + +export const Primary: StoryObj> = { + render: (args) => +} + +export const Example: StoryObj> = { + render: (args) => ( +
+ +
+ + + +
+
+ ) +} From 62c532218747d5f2c93de5e4268bf2ce4a0e9f53 Mon Sep 17 00:00:00 2001 From: Caio Alexandre Troti Caetano Date: Fri, 6 Dec 2024 11:10:10 -0300 Subject: [PATCH 2/5] :sparkles: feat: Added Separator stories --- .../ui/{separator.tsx => separator/index.tsx} | 0 src/components/ui/separator/separator.mdx | 16 ++++++++++ .../ui/separator/separator.stories.tsx | 31 +++++++++++++++++++ 3 files changed, 47 insertions(+) rename src/components/ui/{separator.tsx => separator/index.tsx} (100%) create mode 100644 src/components/ui/separator/separator.mdx create mode 100644 src/components/ui/separator/separator.stories.tsx diff --git a/src/components/ui/separator.tsx b/src/components/ui/separator/index.tsx similarity index 100% rename from src/components/ui/separator.tsx rename to src/components/ui/separator/index.tsx diff --git a/src/components/ui/separator/separator.mdx b/src/components/ui/separator/separator.mdx new file mode 100644 index 00000000..85363e8c --- /dev/null +++ b/src/components/ui/separator/separator.mdx @@ -0,0 +1,16 @@ +import { Meta, Controls, Primary, Canvas } from '@storybook/blocks' +import * as Story from './separator.stories' + + + +# Separator + +Visually or semantically separates content. \ +[Docs](https://www.radix-ui.com/primitives/docs/components/separator) + +### Primary + + + + + diff --git a/src/components/ui/separator/separator.stories.tsx b/src/components/ui/separator/separator.stories.tsx new file mode 100644 index 00000000..c5c9f8d9 --- /dev/null +++ b/src/components/ui/separator/separator.stories.tsx @@ -0,0 +1,31 @@ +import { Meta, StoryObj } from '@storybook/react' +import { Separator } from '.' + +const meta: Meta> = { + title: 'Primitives/Separator', + component: Separator, + argTypes: {} +} + +export default meta + +export const Primary: StoryObj = { + render: () => ( +
+
+

Radix Primitives

+

+ An open-source UI component library. +

+
+ +
+
Blog
+ +
Docs
+ +
Source
+
+
+ ) +} From e88f64a6e26874efd5d05beb23f3f476325a49ad Mon Sep 17 00:00:00 2001 From: Caio Alexandre Troti Caetano Date: Fri, 6 Dec 2024 11:10:22 -0300 Subject: [PATCH 3/5] :sparkles: feat: Added Collapsible stories --- src/components/ui/collapsible/collapsible.mdx | 16 ++++++ .../ui/collapsible/collapsible.stories.tsx | 50 +++++++++++++++++++ .../index.tsx} | 0 3 files changed, 66 insertions(+) create mode 100644 src/components/ui/collapsible/collapsible.mdx create mode 100644 src/components/ui/collapsible/collapsible.stories.tsx rename src/components/ui/{collapsible.tsx => collapsible/index.tsx} (100%) diff --git a/src/components/ui/collapsible/collapsible.mdx b/src/components/ui/collapsible/collapsible.mdx new file mode 100644 index 00000000..85c42d9c --- /dev/null +++ b/src/components/ui/collapsible/collapsible.mdx @@ -0,0 +1,16 @@ +import { Meta, Controls, Primary, Canvas } from '@storybook/blocks' +import * as Story from './collapsible.stories' + + + +# Collapsible + +An interactive component which expands/collapses a panel. \ +[Docs](https://www.radix-ui.com/primitives/docs/components/collapsible) + +### Primary + + + + + diff --git a/src/components/ui/collapsible/collapsible.stories.tsx b/src/components/ui/collapsible/collapsible.stories.tsx new file mode 100644 index 00000000..757ab736 --- /dev/null +++ b/src/components/ui/collapsible/collapsible.stories.tsx @@ -0,0 +1,50 @@ +import { Meta, StoryObj } from '@storybook/react' +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '.' +import React from 'react' +import { Button } from '../button' +import { ChevronsUpDown } from 'lucide-react' + +const meta: Meta> = { + title: 'Primitives/Collapsible', + component: Collapsible, + argTypes: {} +} + +export default meta + +export const Primary: StoryObj = { + render: () => { + const [isOpen, setIsOpen] = React.useState(false) + + return ( + +
+

+ @peduarte starred 3 repositories +

+ + + +
+
+ @radix-ui/primitives +
+ +
+ @radix-ui/colors +
+
+ @stitches/react +
+
+
+ ) + } +} diff --git a/src/components/ui/collapsible.tsx b/src/components/ui/collapsible/index.tsx similarity index 100% rename from src/components/ui/collapsible.tsx rename to src/components/ui/collapsible/index.tsx From f5a3d5fe1e8bc4a65ef5c0c52c5c280572468d78 Mon Sep 17 00:00:00 2001 From: Caio Alexandre Troti Caetano Date: Fri, 6 Dec 2024 11:10:33 -0300 Subject: [PATCH 4/5] :sparkles: feat: Added Command stories --- src/components/ui/command/command.mdx | 16 +++++ src/components/ui/command/command.stories.tsx | 70 +++++++++++++++++++ .../ui/{command.tsx => command/index.tsx} | 0 3 files changed, 86 insertions(+) create mode 100644 src/components/ui/command/command.mdx create mode 100644 src/components/ui/command/command.stories.tsx rename src/components/ui/{command.tsx => command/index.tsx} (100%) diff --git a/src/components/ui/command/command.mdx b/src/components/ui/command/command.mdx new file mode 100644 index 00000000..f9b86ee8 --- /dev/null +++ b/src/components/ui/command/command.mdx @@ -0,0 +1,16 @@ +import { Meta, Controls, Primary, Canvas } from '@storybook/blocks' +import * as Story from './command.stories' + + + +# Command + +Fast, composable, unstyled command menu for React. \ +[Docs](https://cmdk.paco.me/) + +### Primary + + + + + diff --git a/src/components/ui/command/command.stories.tsx b/src/components/ui/command/command.stories.tsx new file mode 100644 index 00000000..1cf5f9ad --- /dev/null +++ b/src/components/ui/command/command.stories.tsx @@ -0,0 +1,70 @@ +import { Meta, StoryObj } from '@storybook/react' +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, + CommandShortcut +} from '.' +import { + Calendar, + Smile, + Calculator, + User, + CreditCard, + Settings +} from 'lucide-react' + +const meta: Meta = { + title: 'Primitives/Command', + component: Command, + argTypes: {} +} + +export default meta + +export const Primary: StoryObj = { + render: (args) => ( + + + + No results found. + + + + Calendar + + + + Search Emoji + + + + Calculator + + + + + + + Profile + ⌘P + + + + Billing + ⌘B + + + + Settings + ⌘S + + + + + ) +} diff --git a/src/components/ui/command.tsx b/src/components/ui/command/index.tsx similarity index 100% rename from src/components/ui/command.tsx rename to src/components/ui/command/index.tsx From 92a1ce149cc9b077d08eaecf6abc64294bd942b7 Mon Sep 17 00:00:00 2001 From: Caio Alexandre Troti Caetano Date: Fri, 6 Dec 2024 11:30:35 -0300 Subject: [PATCH 5/5] :sparkles: feat: Added Combobox stories --- src/components/combobox.tsx | 75 -------------- src/components/ui/combobox/combobox.mdx | 16 +++ .../ui/combobox/combobox.stories.tsx | 98 +++++++++++++++++++ src/components/ui/popover/popover.mdx | 3 +- 4 files changed, 116 insertions(+), 76 deletions(-) delete mode 100644 src/components/combobox.tsx create mode 100644 src/components/ui/combobox/combobox.mdx create mode 100644 src/components/ui/combobox/combobox.stories.tsx diff --git a/src/components/combobox.tsx b/src/components/combobox.tsx deleted file mode 100644 index 41bd747f..00000000 --- a/src/components/combobox.tsx +++ /dev/null @@ -1,75 +0,0 @@ -'use client' - -import * as React from 'react' -import { Check, ChevronsUpDown } from 'lucide-react' - -import { cn } from '@/lib/utils' -import { Button } from '@/components/ui/button' -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem -} from '@/components/ui/command' -import { - Popover, - PopoverContent, - PopoverTrigger -} from '@/components/ui/popover' - -const cloud = [ - { - value: 'aws', - label: 'AWS' - } -] - -export function Combobox() { - const [open, setOpen] = React.useState(false) - const [value, setValue] = React.useState('') - - return ( - - - - - - - - Nothing was found. - - {cloud.map((cloud) => ( - { - setValue(currentValue === value ? '' : currentValue) - setOpen(false) - }} - > - - {cloud.label} - - ))} - - - - - ) -} diff --git a/src/components/ui/combobox/combobox.mdx b/src/components/ui/combobox/combobox.mdx new file mode 100644 index 00000000..1835ca26 --- /dev/null +++ b/src/components/ui/combobox/combobox.mdx @@ -0,0 +1,16 @@ +import { Meta, Controls, Primary, Canvas } from '@storybook/blocks' +import * as Story from './combobox.stories' + + + +# Combobox + +Autocomplete input and command palette with a list of suggestions. \ +The Combobox is built using a composition of the [Popover](/docs/primitives-popover--docs) and the [Command](/docs/primitives-command--docs) components. + +### Primary + + + + + diff --git a/src/components/ui/combobox/combobox.stories.tsx b/src/components/ui/combobox/combobox.stories.tsx new file mode 100644 index 00000000..929b6f4f --- /dev/null +++ b/src/components/ui/combobox/combobox.stories.tsx @@ -0,0 +1,98 @@ +import { Meta, StoryObj } from '@storybook/react' +import { Popover, PopoverContent, PopoverTrigger } from '../popover' +import React from 'react' +import { Button } from '../button' +import { Check, ChevronsUpDown } from 'lucide-react' +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList +} from '../command' +import { cn } from '@/lib/utils' + +const meta: Meta = { + title: 'Primitives/Combobox', + component: Popover, + argTypes: {} +} + +export default meta + +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' + } +] + +export const Primary: StoryObj = { + render: () => { + const [open, setOpen] = React.useState(false) + const [value, setValue] = React.useState('') + + return ( + + + + + + + + + No framework found. + + {frameworks.map((framework) => ( + { + setValue(currentValue === value ? '' : currentValue) + setOpen(false) + }} + > + {framework.label} + + + ))} + + + + + + ) + } +} diff --git a/src/components/ui/popover/popover.mdx b/src/components/ui/popover/popover.mdx index cf9574be..3299eccc 100644 --- a/src/components/ui/popover/popover.mdx +++ b/src/components/ui/popover/popover.mdx @@ -5,7 +5,8 @@ import * as Story from './popover.stories' # Popover -Displays rich content in a portal, triggered by a button. +Displays rich content in a portal, triggered by a button. \ +[Docs](https://www.radix-ui.com/primitives/docs/components/popover) ### Primary