From 372663c7568d589f899c2b84931b0d27eda2cac0 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 | 658 +++++++++--------- 1 file changed, 323 insertions(+), 335 deletions(-) diff --git a/packages/orbit-components/src/Modal/Modal.stories.tsx b/packages/orbit-components/src/Modal/Modal.stories.tsx index 0e8ee94ae2..2d3e493daa 100644 --- a/packages/orbit-components/src/Modal/Modal.stories.tsx +++ b/packages/orbit-components/src/Modal/Modal.stories.tsx @@ -14,14 +14,182 @@ 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 "."; +const modalOutboundSection = ( + + Lorem ipsum dolor sit amet}> + + OUTBOUND + + + + + + + Sat, Mar 31 Trip length: 1h55m + + + London LHR + + Prague PRG + + + + } + actions={ + + } + /> + + + + Sat, Mar 31 Trip length: 1h55m + + + London LHR + + Prague PRG + + + + } + actions={ + + } + /> + + + + Sat, Mar 31 Trip length: 1h55m + + + London LHR + + Prague PRG + + + + } + actions={ + + } + /> + + +); + +const modalInboundSection = ( + + + INBOUND + + + + + + Sat, Mar 31 Trip length: 1h55m + + + London LHR + + Prague PRG + + + + } + actions={ + + } + expandable + /> + + + + Sat, Mar 31 Trip length: 1h55m + + + London LHR + + Prague PRG + + + + } + actions={ + + } + /> + + + + Sat, Mar 31 Trip length: 1h55m + + + London LHR + + Prague PRG + + + + } + actions={ + + } + /> + + +); + type ModalPropsAndCustomArgs = React.ComponentProps & React.ComponentProps & React.ComponentProps & { @@ -36,38 +204,6 @@ const meta: Meta = { parameters: { info: "Check Orbit.Kiwi for more detailed design guidelines.", }, - - args: { - lockScrolling: false, - preventOverlayClose: false, - isMobileFullPage: false, - suppressed: false, - showBack: false, - illustration: NAMES[0], - showSection: false, - fixedFooter: false, - mobileHeader: false, - size: SIZES.NORMAL, - title: "Orbit design system", - description: "I'm lovely description", - children: - "You can try all possible configurations of this component. However, check Orbit.Kiwi for more detailed design guidelines.", - }, - - argTypes: { - size: { - options: Object.values(SIZES), - control: { - type: "select", - }, - }, - illustration: { - options: NAMES, - control: { - type: "select", - }, - }, - }, }; type Story = StoryObj; @@ -75,11 +211,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,105 +226,12 @@ 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 }) => { +export const RemovableSections: Story = { + render: ({ showSection, children }) => { const { Container, onClose } = useModal(); return ( - + } @@ -199,6 +242,9 @@ export const WithoutSection: Story = { {children} )} + + Lorem ipsum dolor sit amet + - } - /> - - - - Sat, Mar 31 Trip length: 1h55m - - - London LHR - - Prague PRG - - - - } - actions={ - - } - /> - - - - Sat, Mar 31 Trip length: 1h55m - - - London LHR - - Prague PRG - - - - } - actions={ - - } - /> - - - + + - - INBOUND + + + Contact information - - - - - Sat, Mar 31 Trip length: 1h55m - - - London LHR - - Prague PRG - - - - } - actions={ - - } - expandable - /> - - - - Sat, Mar 31 Trip length: 1h55m - - - London LHR - - Prague PRG - - - - } - actions={ - - } - /> - - - - Sat, Mar 31 Trip length: 1h55m - - - London LHR - - Prague PRG - - - - } - actions={ - - } + + +