-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WEB-4255] chore: upgrade storybook to v9 in ui package #7164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,22 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import type { Meta, StoryObj } from "@storybook/react-webpack5"; | ||
| import { Avatar } from "./avatar"; | ||
|
|
||
| const meta: Meta<typeof Avatar> = { | ||
| title: "Avatar", | ||
| component: Avatar, | ||
| args: { | ||
| name: "John Doe", | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof Avatar>; | ||
|
|
||
| export const Default: Story = { | ||
| args: { name: "John Doe" }, | ||
| }; | ||
| export const Default: Story = {}; | ||
|
|
||
| export const Large: Story = { | ||
| args: { name: "John Doe" }, | ||
| args: { | ||
| size: "lg", | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,32 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react-webpack5"; | ||
| import React from "react"; | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import { PopoverMenu } from "./popover-menu"; | ||
|
|
||
| const meta: Meta<typeof PopoverMenu> = { | ||
| title: "PopoverMenu", | ||
| component: PopoverMenu, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| // types | ||
| type TPopoverMenu = { | ||
| id: number; | ||
| name: string; | ||
| }; | ||
|
|
||
| type Story = StoryObj<typeof PopoverMenu<TPopoverMenu>>; | ||
|
|
||
| // data | ||
| const data: TPopoverMenu[] = [ | ||
| const data = [ | ||
| { id: 1, name: "John Doe" }, | ||
| { id: 2, name: "Jane Doe" }, | ||
| { id: 3, name: "John Smith" }, | ||
| { id: 4, name: "Jane Smith" }, | ||
| ]; | ||
|
|
||
| // components | ||
| const PopoverMenuItemRender = (item: TPopoverMenu) => ( | ||
| <div className="text-sm text-gray-600 hover:text-gray-700 rounded-sm cursor-pointer hover:bg-gray-200 transition-all px-1.5 py-0.5 capitalize"> | ||
| {item.name} | ||
| </div> | ||
| ); | ||
|
|
||
| // stories | ||
| export const Default: Story = { | ||
| const meta: Meta<typeof PopoverMenu<(typeof data)[number]>> = { | ||
| title: "PopoverMenu", | ||
| component: PopoverMenu, | ||
| args: { | ||
| data, | ||
| popperPosition: "bottom-start", | ||
| panelClassName: "rounded bg-gray-100 p-2", | ||
| data: data, | ||
| keyExtractor: (item, index: number) => `${item.id}-${index}`, | ||
| render: (item) => PopoverMenuItemRender(item), | ||
| keyExtractor: (item, index) => `${item.id}-${index}`, | ||
| render: (item) => ( | ||
| <div className="text-sm text-gray-600 hover:text-gray-700 rounded-sm cursor-pointer hover:bg-gray-200 transition-all px-1.5 py-0.5 capitalize"> | ||
| {item.name} | ||
| </div> | ||
| ), | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,43 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import type { Meta, StoryObj } from "@storybook/react-webpack5"; | ||
| import React from "react"; | ||
| import { Popover } from "./popover"; | ||
|
|
||
| const meta: Meta<typeof Popover> = { | ||
| title: "Popover", | ||
| component: Popover, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| // types | ||
| type Story = StoryObj<typeof Popover>; | ||
|
|
||
| // data | ||
|
|
||
| // components | ||
| const RenderCustomPopoverComponent = ( | ||
| <div className="space-y-2"> | ||
| <div className="text-sm font-medium text-gray-500">Your custom component</div> | ||
| <div> | ||
| {["option1", "option2", "option3"].map((option) => ( | ||
| <div | ||
| key={option} | ||
| className="text-sm text-gray-600 hover:text-gray-700 rounded-sm cursor-pointer hover:bg-gray-200 transition-all px-1.5 py-0.5 capitalize" | ||
| > | ||
| {option} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
|
|
||
| // stories | ||
| export const Default: Story = { | ||
| args: { | ||
| popperPosition: "bottom-start", | ||
| panelClassName: "rounded bg-gray-100 p-2", | ||
| children: RenderCustomPopoverComponent, | ||
| children: ( | ||
| <div className="space-y-2"> | ||
| <div className="text-sm font-medium text-gray-500">Your custom component</div> | ||
| <div> | ||
| {["option1", "option2", "option3"].map((option) => ( | ||
| <div | ||
| key={option} | ||
| className="text-sm text-gray-600 hover:text-gray-700 rounded-sm cursor-pointer hover:bg-gray-200 transition-all px-1.5 py-0.5 capitalize" | ||
| > | ||
| {option} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ), | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = {}; | ||
|
|
||
| export const CustomMenuButton: Story = { | ||
| args: { | ||
| popperPosition: "bottom-start", | ||
| button: ( | ||
| <div className="p-2 text-sm font-medium rounded bg-gray-100 hover:bg-gray-200 transition-all"> | ||
| Custom Menu Button | ||
| </div> | ||
| ), | ||
| panelClassName: "rounded bg-gray-100 p-2", | ||
| children: RenderCustomPopoverComponent, | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,36 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import type { Meta, StoryObj } from "@storybook/react-webpack5"; | ||
| import React from "react"; | ||
| import { Sortable } from "./sortable"; | ||
|
|
||
| const meta: Meta<typeof Sortable> = { | ||
| title: "Sortable", | ||
| component: Sortable, | ||
| }; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof Sortable>; | ||
|
|
||
| const data = [ | ||
| { id: "1", name: "John Doe" }, | ||
| { id: "2", name: "Satish" }, | ||
| { id: "3", name: "Alice" }, | ||
| { id: "4", name: "Bob" }, | ||
| { id: "5", name: "Charlie" }, | ||
| ]; | ||
| export const Default: Story = { | ||
|
|
||
| const meta: Meta<typeof Sortable<(typeof data)[number]>> = { | ||
| title: "Sortable", | ||
| component: Sortable, | ||
| args: { | ||
| data, | ||
| render: (item: any) => ( | ||
| render: (item) => ( | ||
| // <Draggable data={item} className="rounded-lg"> | ||
| <div className="border ">{item.name}</div> | ||
| // </Draggable> | ||
| ), | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| onChange: (data) => console.log(data.map(({ id }: any) => id)), | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| keyExtractor: (item: any) => item.id, | ||
| keyExtractor: (item) => item.id, | ||
| }, | ||
| argTypes: { | ||
| onChange: { | ||
| action: true, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.