diff --git a/packages/orbit-components/src/Stack/Stack.stories.tsx b/packages/orbit-components/src/Stack/Stack.stories.tsx index 1181fb3e53..a54be1f985 100644 --- a/packages/orbit-components/src/Stack/Stack.stories.tsx +++ b/packages/orbit-components/src/Stack/Stack.stories.tsx @@ -1,4 +1,5 @@ import * as React from "react"; +import type { Meta, StoryObj } from "@storybook/react"; import { action } from "@storybook/addon-actions"; import { DIRECTIONS, ALIGNS, SPACINGS, JUSTIFY } from "../utils/layout/consts"; @@ -37,845 +38,355 @@ import ChoiceGroup from "../ChoiceGroup"; import Stack from "."; -export default { +const meta: Meta = { title: "Stack", -}; - -export const Default = () => ( - - - - -); - -Default.story = { - parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", - }, -}; - -export const MobileProperties = ({ - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, -}) => { - return ( - - - - - ); -}; - -MobileProperties.story = { - name: "Mobile properties", - - parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", + component: Stack, + + args: { + inline: false, + direction: undefined, + wrap: false, + grow: true, + shrink: false, + basis: "auto", + align: ALIGNS.END, + justify: undefined, + spacing: undefined, + spaceAfter: undefined, }, -}; - -MobileProperties.args = { - inline: false, - direction: DIRECTIONS.ROW, - wrap: false, - grow: true, - shrink: false, - basis: "auto", - align: ALIGNS.START, - justify: JUSTIFY.START, - spacing: SPACINGS.NONE, - spaceAfter: undefined, -}; -MobileProperties.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", + argTypes: { + direction: { + options: Object.values(DIRECTIONS), + control: { + type: "select", + }, }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", + align: { + options: Object.values(ALIGNS), + control: { + type: "select", + }, }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", + justify: { + options: Object.values(JUSTIFY), + control: { + type: "select", + }, }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", + spacing: { + options: Object.values(SPACINGS), + control: { + type: "select", + }, }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", + spaceAfter: { + options: Object.values(SPACINGS_AFTER), + control: { + type: "select", + }, }, }, }; -export const MediumMobileProperties = ({ - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, -}) => { - const mediumMobile = { - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, - }; +export default meta; +type Story = StoryObj; - return ( - - - +export const Default: Story = { + render: () => ( + + + - ); -}; - -MediumMobileProperties.story = { - name: "MediumMobile properties", + ), parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", + info: "This is the default configuration of this component. Visit Orbit.Kiwi for more detailed guidelines.", + controls: { + disable: true, + }, }, }; -MediumMobileProperties.args = { - inline: false, - direction: undefined, - wrap: false, - grow: true, - shrink: false, - basis: "auto", - align: ALIGNS.END, - justify: undefined, - spacing: undefined, - spaceAfter: undefined, -}; +export const MobileProperties: Story = { + render: args => ( + + + + + ), -MediumMobileProperties.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", - }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", - }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", - }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", - }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", - }, + args: { + direction: DIRECTIONS.ROW, + align: ALIGNS.START, + justify: JUSTIFY.START, + spacing: SPACINGS.NONE, }, }; -export const LargeMobileProperties = ({ - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, -}) => { - const largeMobile = { - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, - }; - - return ( - +export const MediumMobileProperties: Story = { + render: args => ( + - ); -}; - -LargeMobileProperties.story = { - name: "LargeMobile properties", - - parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", - }, -}; - -LargeMobileProperties.args = { - inline: false, - direction: undefined, - wrap: false, - grow: true, - shrink: false, - basis: "auto", - align: ALIGNS.END, - justify: undefined, - spacing: undefined, - spaceAfter: undefined, -}; + ), -LargeMobileProperties.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", - }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", - }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", - }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", - }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", - }, + args: { + direction: DIRECTIONS.COLUMN, }, }; -export const TabletProperties = ({ - inline, - direction, - spaceAfter, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, -}) => { - const tablet = { - inline, - direction, - spaceAfter, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - }; - - return ( - +export const LargeMobileProperties: Story = { + render: args => ( + - ); + ), }; -TabletProperties.story = { - name: "Tablet properties", - - parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", - }, -}; - -TabletProperties.args = { - inline: false, - direction: undefined, - wrap: false, - grow: true, - shrink: false, - basis: "auto", - align: ALIGNS.END, - justify: undefined, - spacing: undefined, - spaceAfter: undefined, -}; - -TabletProperties.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", - }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", - }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", - }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", - }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", - }, - }, -}; - -export const DesktopProperties = ({ - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, -}) => { - const desktop = { - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, - }; - - return ( - +export const TabletProperties: Story = { + render: args => ( + - ); -}; - -DesktopProperties.story = { - name: "Desktop properties", - - parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", - }, -}; - -DesktopProperties.args = { - inline: false, - direction: undefined, - wrap: false, - grow: true, - shrink: false, - basis: "auto", - align: ALIGNS.END, - justify: undefined, - spacing: undefined, - spaceAfter: undefined, -}; + ), -DesktopProperties.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", - }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", - }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", - }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", - }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", - }, + args: { + spacing: SPACINGS.TWO_HUNDRED, }, }; -export const LargeDesktopProperties = ({ - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, -}) => { - const largeDesktop = { - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, - }; - - return ( - +export const DesktopProperties: Story = { + render: args => ( + - ); -}; + ), -LargeDesktopProperties.story = { - name: "LargeDesktop properties", - - parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", + args: { + direction: DIRECTIONS.ROW, + align: ALIGNS.START, + justify: JUSTIFY.BETWEEN, }, }; -LargeDesktopProperties.args = { - inline: false, - direction: undefined, - wrap: false, - grow: true, - shrink: false, - basis: "auto", - align: ALIGNS.END, - justify: undefined, - spacing: undefined, - spaceAfter: undefined, -}; +export const LargeDesktopProperties: Story = { + render: args => ( + + + + + ), -LargeDesktopProperties.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", - }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", - }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", - }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", - }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", - }, + args: { + spacing: SPACINGS.EIGHT_HUNDRED, }, }; -export const NestedExample = () => ( - - - email@gmail.com - - - - - +export const NestedExample: Story = { + render: () => ( + + + email@gmail.com + + + + + + + + Forgot password? + - - Forgot password? - - -); - -NestedExample.story = { - name: "Nested example", + ), parameters: { - info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", + controls: { + disable: true, + }, }, }; -export const Playground = ({ - dataTest, - flex, - inline, - direction, - wrap, - grow, - shrink, - basis, - align, - justify, - spacing, - spaceAfter, - legacy, - mediumMobile, - largeMobile, - tablet, - desktop, - largeDesktop, -}) => { - return ( - +export const Playground: Story = { + render: args => ( + - ); -}; + ), -Playground.story = { parameters: { info: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", }, -}; -Playground.args = { - dataTest: "test", - flex: true, - inline: false, - direction: undefined, - wrap: false, - grow: true, - shrink: false, - legacy: false, - basis: "", - align: ALIGNS.START, - justify: JUSTIFY.START, - spacing: SPACINGS.NONE, - spaceAfter: SPACINGS_AFTER.SMALL, - mediumMobile: { - direction: DIRECTIONS.COLUMN, - }, - largeMobile: { - align: ALIGNS.END, - }, - tablet: { - spacing: SPACINGS.TWO_HUNDRED, - }, - desktop: { - justify: JUSTIFY.BETWEEN, - direction: DIRECTIONS.ROW, + args: { + flex: true, + legacy: false, + basis: "", align: ALIGNS.START, - }, - largeDesktop: { - spacing: SPACINGS.EIGHT_HUNDRED, + justify: JUSTIFY.START, + spacing: SPACINGS.NONE, + spaceAfter: SPACINGS_AFTER.SMALL, }, }; -Playground.argTypes = { - direction: { - options: Object.values(DIRECTIONS), - control: { - type: "select", - }, - }, - align: { - options: Object.values(ALIGNS), - control: { - type: "select", - }, - }, - justify: { - options: Object.values(JUSTIFY), - control: { - type: "select", - }, - }, - spacing: { - options: Object.values(SPACINGS), - control: { - type: "select", - }, - }, - spaceAfter: { - options: Object.values(SPACINGS_AFTER), - control: { - type: "select", - }, - }, -}; - -export const ComponentsPreview = () => ( - - - - My message - - - My message - - - - - - Hola amigo - - - Hola amigo - Hola amigo - - - - - - - - - - - - - +export const ComponentsPreview: Story = { + render: () => ( + + + + My message + + + My message + + + - - - - - - - - - - - Insert your title here... - subtitle - - Insert your title here...} - description="subtitle" - > - Content - - - - - - - Insert your title here...} - description="subtitle" + Hola amigo + + + Hola amigo + Hola amigo + + + + + + + + + + + + + + + + + + + + + + + + + + Insert your title here... + subtitle + + Insert your title here...} + description="subtitle" + > + Content + + + + + + + Insert your title here...} + description="subtitle" + /> + Insert your title here...} + > + Hidden content + + Insert your title here...} + description="subtitle" + /> + + + + - Insert your title here...}> - Hidden content - - Insert your title here...} - description="subtitle" + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hola Amigo - Hola Amigo - - - Hola Amigo - Hola Amigo - - - - Hola Amigo - - - - Hola Amigo - - - - Hola Amigo - - - - ( { value: 3, label: "Third item" }, ]} /> - - - - - + + +