diff --git a/lib/components/Flex/Flex.mdx b/lib/components/Flex/Flex.mdx index febcfc2b..c856f3c1 100644 --- a/lib/components/Flex/Flex.mdx +++ b/lib/components/Flex/Flex.mdx @@ -28,39 +28,4 @@ You can use `space`, `layout`, and `flexbox` properties with `Flex`. - [CSS Flexbox reference](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) - [systemtheme.js](https://github.com/orchestrated-io/orcs-design-system/blob/master/packages/orcs-design-system/lib/systemtheme.js) (our arrays for design system values) -By default, we've set certain values on `Flex` properties as documented in the table below. - - -## Upgrading - -This component is a **breaking change** that replaces the [previous Flex component](https://www.npmjs.com/package/styled-flex-component). Use the following table as a guide to convert from the old properties to new `Flex` properties. Refer to [systemtheme.js](https://github.com/orchestrated-io/orcs-design-system/blob/master/packages/orcs-design-system/lib/systemtheme.js) for values. - -### `Flex` properties - -| **Old** | **New** | -| ----------------- | --------------------------------------------------- | -| `full` | `width="100%" height="100%" flexBasis="100%"` | -| `inline` | `display="inline-flex"` | -| `center` | `justifyContent="center" alignItems="center"` | -| `rowReverse` | `flexDirection="row-reverse"` | -| `column` | `flexDirection="column"` | -| `columnReverse` | `flexDirection="column-reverse"` | -| `wrap` | `flexWrap="wrap"` | -| `wrapReverse` | `flexWrap='wrap-reverse'` | -| `justifyStart` | `justifyContent="flex-start"` | -| `justifyEnd` | `justifyContent="flex-end"` | -| `justifyCenter` | `justifyContent="center"` | -| `justifyBetween` | `justifyContent="space-between"` | -| `justifyAround` | `justifyContent="space-around"` | -| `justifyEvenly` | `justifyContent="space-evenly"` (default behaviour) | -| `alignCenter` | `alignItems="center"` | -| `alignStart` | `alignItems="flex-start"` | -| `alignEnd` | `alignItems="flex-end"` | -| `alignBaseline` | `alignItems="baseline"` | -| `alignStretch` | `alignItems="stretch"` | -| `contentCenter` | `alignContent="center"` | -| `contentStart` | `alignContent="flex-start"` | -| `contentEnd` | `alignContent="flex-end"` | -| `contentBaseline` | `alignContent="baseline"` | -| `contentStretch` | `alignContent="stretch"` | diff --git a/lib/components/Flex/Flex.stories.js b/lib/components/Flex/Flex.stories.js index 922b53bc..e667ef18 100644 --- a/lib/components/Flex/Flex.stories.js +++ b/lib/components/Flex/Flex.stories.js @@ -1,7 +1,6 @@ import React from "react"; import Flex from "."; import Button from "../Button"; -import Spacer from "../Spacer"; export default { title: "Components/Flex", @@ -9,15 +8,13 @@ export default { }; export const basicFlex = () => ( - - - - - - - - - + + + + + + + ); basicFlex.storyName = "Basic Flex"; diff --git a/lib/components/Flex/FlexItem.mdx b/lib/components/Flex/FlexItem.mdx index 75efbdb3..8864999b 100644 --- a/lib/components/Flex/FlexItem.mdx +++ b/lib/components/Flex/FlexItem.mdx @@ -18,17 +18,3 @@ To use `FlexItem` to control the spacing between children of `Flex` you must als You don't necessarily need to use `` as the direct child element to `` unless you need to apply specific `flexbox` properties to the item. In most cases, once you set the desired properties on `` it will layout the child elements as intended, whether these be `` or any other component like `` or even standard HTML like a `
` or ``. However, if you want to use the flex-specific CSS properties for items within the container, like `flex` or `align-self`, you will need to use `FlexItem` to apply these properties. - -## Upgrading - -This component is a **breaking change** that replaces the [previous Flex component](https://www.npmjs.com/package/styled-flex-component). Use the following table as a guide to convert from the old properties to new `Flex` properties. Refer to [systemtheme.js](https://github.com/orchestrated-io/orcs-design-system/blob/master/packages/orcs-design-system/lib/systemtheme.js) for values. - -### `FlexItem` properties - -| **Old** | **New** | -| ---------- | ---------------- | -| `order` | `order` | -| `basis` | `flexBasis` | -| `grow` | `flexGrow` | -| `shrink` | `flexShrink` | -| `noShrink` | `flexShrink="0"` | diff --git a/lib/components/Flex/index.js b/lib/components/Flex/index.js index 30def5ee..b9675e2f 100644 --- a/lib/components/Flex/index.js +++ b/lib/components/Flex/index.js @@ -18,7 +18,7 @@ const FlexWrapper = styled("div") : props["data-testid"] ? props["data-testid"] : null - }))(css({ boxSizing: "border-box" }), FlexStyles); + }))((props) => css({ boxSizing: "border-box", gap: props.gap }), FlexStyles); const FlexItem = styled("div")( css({ @@ -27,8 +27,12 @@ const FlexItem = styled("div")( FlexStyles ); -export default function Flex({ children, theme, ...props }) { - const component = {children}; +export default function Flex({ children, gap, theme, ...props }) { + const component = ( + + {children} + + ); if (theme) { return (