-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(stories): organize storybook files and breakdown large stori…
…es into smaller files
- Loading branch information
1 parent
ac0b868
commit 49f4f1d
Showing
485 changed files
with
10,722 additions
and
9,925 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -5,4 +5,5 @@ module.exports = { | |
endOfLine: "lf", | ||
tabWidth: 2, | ||
trailingComma: "es5", | ||
printWidth: 80, | ||
}; |
This file contains 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 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
2 changes: 1 addition & 1 deletion
2
...mon/AUTOCOMPLETE_MULTI_COLUMN_OPTIONS.tsx → ...ook/AUTOCOMPLETE_MULTI_COLUMN_OPTIONS.tsx
This file contains 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
2 changes: 1 addition & 1 deletion
2
...on/AUTOCOMPLETE_SINGLE_COLUMN_OPTIONS.tsx → ...ok/AUTOCOMPLETE_SINGLE_COLUMN_OPTIONS.tsx
This file contains 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
2 changes: 1 addition & 1 deletion
2
...s/components/src/common/customSdsIcon.tsx → ...ts/src/common/storybook/customSdsIcon.tsx
This file contains 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
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Extra Short Lorem Ipsum = 1 sentence | ||
|
||
export const EXTRA_SHORT_LOREM_IPSUM = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`; | ||
|
||
// Short Lorem Ipsum = 2 sentences | ||
|
||
export const SHORT_LOREM_IPSUM = `${EXTRA_SHORT_LOREM_IPSUM} Imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper.`; | ||
|
||
// Medium Lorem Ipsum = 5 sentences | ||
|
||
export const MEDIUM_LOREM_IPSUM = `${SHORT_LOREM_IPSUM} Urna duis convallis convallis tellus id interdum velit laoreet id. Donec ultrices tincidunt arcu non sodales. Aliquam eleifend mi in nulla posuere.`; | ||
|
||
// Long Lorem Ipsum = 1 paragraph | ||
|
||
export const LONG_LOREM_IPSUM = `${MEDIUM_LOREM_IPSUM} Quisque id diam vel quam elementum pulvinar. Euismod quis viverra nibh cras pulvinar mattis nunc sed blandit. Id consectetur purus ut faucibus. Molestie at elementum eu facilisis sed odio morbi quis commodo. Et leo duis ut diam. Nulla facilisi cras fermentum odio. Magnis dis parturient montes nascetur ridiculus mus mauris. Maecenas volutpat blandit aliquam etiam erat. Arcu dui vivamus arcu felis bibendum ut tristique. Id porta nibh venenatis cras sed felis eget. Mi ipsum faucibus vitae aliquet nec ullamcorper.`; | ||
|
||
// Extra Long Lorem Ipsum = 3 paragraphs | ||
|
||
export const EXTRA_LONG_LOREM_IPSUM = `${LONG_LOREM_IPSUM} ${LONG_LOREM_IPSUM}`; |
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
packages/components/src/core/Accordion/__storybook__/constants.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const ACCORDION_EXCLUDED_CONTROLS = [ | ||
"id", | ||
"subtitle", | ||
"useDivider", | ||
"togglePosition", | ||
]; |
71 changes: 71 additions & 0 deletions
71
packages/components/src/core/Accordion/__storybook__/index.stories.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Args, Meta } from "@storybook/react"; | ||
import { BADGE } from "@geometricpanda/storybook-addon-badges"; | ||
import { Accordion } from "./stories/default"; | ||
import { ACCORDION_EXCLUDED_CONTROLS } from "./constants"; | ||
import { LivePreviewDemo } from "./stories/livePreview"; | ||
|
||
export default { | ||
argTypes: { | ||
id: { | ||
control: { type: "text" }, | ||
required: true, | ||
}, | ||
subtitle: { | ||
control: { type: "text" }, | ||
}, | ||
togglePosition: { | ||
control: { type: "select" }, | ||
options: ["right", "left"], | ||
}, | ||
useDivider: { | ||
control: { type: "boolean" }, | ||
}, | ||
}, | ||
component: Accordion, | ||
parameters: { | ||
badges: [BADGE.STABLE], | ||
}, | ||
title: "Components/Accordion", | ||
} as Meta; | ||
|
||
// Default | ||
|
||
export const Default = { | ||
args: { | ||
togglePosition: "right", | ||
}, | ||
}; | ||
|
||
// LivePreview | ||
|
||
export const LivePreview = { | ||
parameters: { | ||
controls: { | ||
exclude: ACCORDION_EXCLUDED_CONTROLS, | ||
}, | ||
snapshot: { | ||
skip: true, | ||
}, | ||
}, | ||
render: (args: Args) => <LivePreviewDemo {...args} />, | ||
}; | ||
|
||
// Test | ||
|
||
export const Test = { | ||
args: { | ||
id: "test-story", | ||
togglePosition: "right", | ||
}, | ||
parameters: { | ||
controls: { | ||
exclude: ACCORDION_EXCLUDED_CONTROLS, | ||
}, | ||
snapshot: { | ||
skip: true, | ||
}, | ||
}, | ||
render: (props: Args): JSX.Element => ( | ||
<Accordion {...props} data-testid="accordion" /> | ||
), | ||
}; |
23 changes: 23 additions & 0 deletions
23
packages/components/src/core/Accordion/__storybook__/stories/default.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Args } from "@storybook/react"; | ||
import RawAccordion, { | ||
AccordionDetails, | ||
AccordionHeader, | ||
} from "src/core/Accordion"; | ||
import { EXTRA_SHORT_LOREM_IPSUM } from "src/common/storybook/loremIpsum"; | ||
|
||
export const Accordion = (props: Args): JSX.Element => { | ||
const { id, subtitle, useDivider, togglePosition } = props; | ||
return ( | ||
<RawAccordion | ||
id={id} | ||
useDivider={useDivider} | ||
togglePosition={togglePosition} | ||
{...props} | ||
> | ||
<AccordionHeader id={`${id}-header`} subtitle={subtitle}> | ||
Accordion Header | ||
</AccordionHeader> | ||
<AccordionDetails>{EXTRA_SHORT_LOREM_IPSUM}</AccordionDetails> | ||
</RawAccordion> | ||
); | ||
}; |
37 changes: 37 additions & 0 deletions
37
packages/components/src/core/Accordion/__storybook__/stories/livePreview.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Args } from "@storybook/react"; | ||
import { Accordion } from "./default"; | ||
|
||
const livePreviewStyles = { | ||
display: "grid", | ||
gridColumnGap: "24px", | ||
gridRowGap: "50px", | ||
gridTemplateColumns: "repeat(4, 200px)", | ||
}; | ||
|
||
export function LivePreviewDemo(props: Args): JSX.Element { | ||
return ( | ||
<div style={livePreviewStyles as React.CSSProperties}> | ||
<Accordion | ||
id="accordion-1" | ||
togglePosition="right" | ||
useDivider | ||
{...props} | ||
/> | ||
<Accordion | ||
id="accordion-2" | ||
togglePosition="right" | ||
subtitle="Optional Subtitle" | ||
useDivider | ||
{...props} | ||
/> | ||
<Accordion id="accordion-3" togglePosition="left" useDivider {...props} /> | ||
<Accordion | ||
id="accordion-4" | ||
togglePosition="left" | ||
subtitle="Optional Subtitle" | ||
useDivider | ||
{...props} | ||
/> | ||
</div> | ||
); | ||
} |
File renamed without changes.
This file contains 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
2 changes: 1 addition & 1 deletion
2
...ponents/src/core/Accordion/index.test.tsx → ...c/core/Accordion/__tests__/index.test.tsx
This file contains 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
129 changes: 0 additions & 129 deletions
129
packages/components/src/core/Accordion/index.stories.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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.