import * as React from "react"; import styled from "@emotion/styled"; import { Story, Meta } from "@storybook/react"; import Flex from "../components/Flex"; import FlexItem from "../components/FlexItem"; import { themeBrandPrimary } from "../../../../design-tokens/build/js/designTokens"; const SampleContainer = styled.div` background-color: #f5f5f5; > * { height: 80px; } `; const DemoChild = styled.div` background-color: white; border: 2px solid ${themeBrandPrimary}; height: 100%; padding: 4px; text-align: center; `; export default { title: "Layout/FlexItem", component: FlexItem, argTypes: { flex: { options: ["shrink", "grow"] }, growFactor: { options: [1, 2] }, order: { options: [1, 2, 3, 4] }, className: { control: { disable: true } } } } as Meta; const flexChildren = [1, 2, 3, 4]; const Template: Story = args => ( {flexChildren.map((flexChild, i) => ( {flexChild} ))} ); export const Default = Template.bind({}); export const FlexShrink = args => ( shrink
grow
); export const ResponsiveFlexValue = args => (

The first flex item is `flex="shrink"` on narrower viewports and `flex="grow"` on wider viewports

dyanmic
grow
); export const ResponsiveGrowFactor = args => (

The first flex item has a grow factor of 1 on narrower viewports, and a grow factor of 3 on wider viewports

growFactor 2 growFactor 1 growFactor 1
); export const Order = args => { return ( Use the Control panel to change my order. 2 3 4 ); }; export const ResponsiveOrder = args => { return (

The first flex-item has an order of 0 on narrower viewports, and an order of 3 on wider viewports

0 or 3 2 3
); };