From a39deb8f6bf1424400658ab3bce4160489467529 Mon Sep 17 00:00:00 2001 From: Sarka Chwastkova Date: Tue, 3 Sep 2024 15:29:09 +0200 Subject: [PATCH] chore(Modal): migrate from CSF2 to CSF3 - pt2 --- .../src/Modal/Modal.stories.tsx | 315 +++++++++--------- 1 file changed, 158 insertions(+), 157 deletions(-) diff --git a/packages/orbit-components/src/Modal/Modal.stories.tsx b/packages/orbit-components/src/Modal/Modal.stories.tsx index 0e8ee94ae2..26c146358a 100644 --- a/packages/orbit-components/src/Modal/Modal.stories.tsx +++ b/packages/orbit-components/src/Modal/Modal.stories.tsx @@ -14,11 +14,23 @@ import Stack from "../Stack"; import ButtonLink from "../ButtonLink"; import RenderInRtl from "../utils/rtl/RenderInRtl"; import Card from "../Card"; -import CarrierLogo from "../CarrierLogo"; import CardSection from "../Card/CardSection"; import Tooltip from "../Tooltip"; -import Tile from "../Tile"; import Box from "../Box"; +import InputField from "../InputField"; +import InputGroup from "../InputGroup"; +import Select from "../Select"; +import CountryFlag from "../CountryFlag"; +import Radio from "../Radio"; +import Checkbox from "../Checkbox"; +import TextLink from "../TextLink"; +import Itinerary, { + ItinerarySegment, + ItinerarySegmentDetail, + ItinerarySegmentStop, + ItineraryStatus, +} from "../Itinerary"; +import Badge from "../Badge"; import Modal, { ModalHeader, ModalSection, ModalFooter } from "."; @@ -52,6 +64,10 @@ const meta: Meta = { description: "I'm lovely description", children: "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", + flex: ["0 0 auto", "1 1 100%"], + hasCloseButton: true, + disableAnimation: false, + labelClose: "Close", }, argTypes: { @@ -75,11 +91,11 @@ type Story = StoryObj; export default meta; function useModal() { - const [open, toggle] = React.useReducer((_, next) => next, true); + const [open, toggle] = React.useState(true); return { Container: ({ children }) => ( <> -
{children}
+ {open && children} ), @@ -90,156 +106,6 @@ function useModal() { }; } -export const Sizes: Story = { - render: ({ title, description, children, ...args }) => { - const { Container, onClose } = useModal(); - - return ( - - - {description} - - {children} - - - - ); - }, - - args: { - illustration: undefined, - }, - - parameters: { - controls: { - exclude: [ - "fixedFooter", - - "showBack", - "showSection", - "suppressed", - "illustration", - "autoFocus", - "isMobileFullPage", - "preventOverlayClose", - "hasCloseButton", - "disableAnimation", - "labelClose", - "lockScrolling", - ], - }, - }, -}; - -export const ShortModal: Story = { - render: ({ ...args }) => { - const { Container, onClose } = useModal(); - return ( - - - - - - OUTBOUND - - - - - - Sat, Mar 31 Trip length: 1h55m - - - London LHR - - Prague PRG - - - - } - > - Hidden Content - - - - - - ); - }, - - args: { - illustration: undefined, - size: undefined, - title: undefined, - description: undefined, - }, - - parameters: { - controls: { - disable: true, - }, - }, -}; - -export const WithoutSection: Story = { - render: ({ showSection, children, ...args }) => { - const { Container, onClose } = useModal(); - return ( - - - } - description="Select a flight below to see the menu (where available)" - /> - {showSection && ( - - {children} - - )} - - - - - - - ); - }, - - args: { - title: undefined, - description: undefined, - illustration: undefined, - size: undefined, - }, - - parameters: { - controls: { - exclude: [ - "size", - "title", - "description", - "mobileHeader", - "fixedFooter", - "showBack", - "suppressed", - "illustration", - "autoFocus", - "isMobileFullPage", - "preventOverlayClose", - "hasCloseButton", - "disableAnimation", - "labelClose", - "lockScrolling", - ], - }, - }, -}; - export const RemovableSections: Story = { render: ({ showSection, children, lockScrolling }) => { const { Container, onClose } = useModal(); @@ -273,6 +139,7 @@ export const RemovableSections: Story = { parameters: { controls: { exclude: [ + "flex", "size", "title", "description", @@ -473,11 +340,13 @@ export const WithFixedFooter: Story = { illustration: undefined, title: undefined, description: undefined, + fixedFooter: true, }, parameters: { controls: { exclude: [ + "flex", "size", "title", "description", @@ -499,8 +368,140 @@ export const WithFixedFooter: Story = { }, }; -type PlagroundStory = StoryObj; -export const Playground: PlagroundStory = { +export const WithForm: Story = { + render: ({ showSection }) => { + const { Container, onClose } = useModal(); + + return ( + + + + + + + + Contact information + + + +