diff --git a/.changeset/proud-pugs-decide.md b/.changeset/proud-pugs-decide.md new file mode 100644 index 0000000000..084e1710be --- /dev/null +++ b/.changeset/proud-pugs-decide.md @@ -0,0 +1,5 @@ +--- +'@commercetools-uikit/card': minor +--- + +Make card content to always use all available vertical space. diff --git a/.changeset/stale-radios-punch.md b/.changeset/stale-radios-punch.md new file mode 100644 index 0000000000..368da8c0e9 --- /dev/null +++ b/.changeset/stale-radios-punch.md @@ -0,0 +1,8 @@ +--- +'@commercetools-uikit/spacings-inset-squish': minor +'@commercetools-uikit/spacings-inset': minor +--- + +Refactor vertical space usage so consumers can control it. + +There's a new property named `height` (available values: `auto` and `100%`; the former is the default) that will allow consumers to control the vertical space usage of the component. diff --git a/packages/components/card/src/card.tsx b/packages/components/card/src/card.tsx index f3f024ad69..653e981a3b 100644 --- a/packages/components/card/src/card.tsx +++ b/packages/components/card/src/card.tsx @@ -55,7 +55,9 @@ const Card = (props: TCardProps) => ( // This is mostly useful in case custom styles are targeting this element.
{props.children}
) : ( - {props.children} + + {props.children} + )} ); diff --git a/packages/components/card/src/card.visualroute.jsx b/packages/components/card/src/card.visualroute.jsx index 290faa2eae..04a7fe3407 100644 --- a/packages/components/card/src/card.visualroute.jsx +++ b/packages/components/card/src/card.visualroute.jsx @@ -17,10 +17,11 @@ const WrappedCard = (props) => ( css={css` margin: 16px; width: 300px; + height: ${props.height || 'auto'}; `} {...props} > - {props.children} + {props.children} ); @@ -28,74 +29,94 @@ export const component = () => ( - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} - {text} + {text} + + + + + +
+
+ {text} +
+
+ {text} +
+
diff --git a/packages/components/spacings/spacings-inset-squish/README.md b/packages/components/spacings/spacings-inset-squish/README.md index de8ecb3425..89df6c164a 100644 --- a/packages/components/spacings/spacings-inset-squish/README.md +++ b/packages/components/spacings/spacings-inset-squish/README.md @@ -39,6 +39,7 @@ import Spacings from '@commercetools-uikit/spacings'; | Props | Type | Required | Values | Default | | ---------- | ---------------- | :------: | ----------------- | ------- | | `scale` | `String` | - | `['s', 'm', 'l']` | `m` | +| `height` | `String` | - | `auto`, `100%` | `auto` | | `children` | `PropTypes.node` | - | - | - | ## Scales diff --git a/packages/components/spacings/spacings-inset-squish/src/inset-squish.tsx b/packages/components/spacings/spacings-inset-squish/src/inset-squish.tsx index 7df7672e68..3ee99fd59f 100644 --- a/packages/components/spacings/spacings-inset-squish/src/inset-squish.tsx +++ b/packages/components/spacings/spacings-inset-squish/src/inset-squish.tsx @@ -6,6 +6,7 @@ import { filterDataAttributes } from '@commercetools-uikit/utils'; export type TScale = 's' | 'm' | 'l'; export type TInsetSquishProps = { scale: TScale; + height: 'auto' | '100%'; children: ReactNode; }; @@ -26,15 +27,16 @@ const InsetSquish = (props: TInsetSquishProps) => (
{props.children}
); -const defaultProps: Pick = { +const defaultProps: Pick = { scale: 'm', + height: 'auto', }; InsetSquish.displayName = 'InsetSquish'; InsetSquish.defaultProps = defaultProps; diff --git a/packages/components/spacings/spacings-inset/README.md b/packages/components/spacings/spacings-inset/README.md index 9897477fe6..5c207de382 100644 --- a/packages/components/spacings/spacings-inset/README.md +++ b/packages/components/spacings/spacings-inset/README.md @@ -29,6 +29,7 @@ import Spacings from '@commercetools-uikit/spacings'; | Props | Type | Required | Values | Default | | ---------- | ---------------- | :------: | ----------------------------- | ------- | | `scale` | `String` | - | `['xs', 's', 'm', 'l', 'xl']` | `x` | +| `height` | `String` | - | `auto`, `100%` | `auto` | | `children` | `PropTypes.node` | - | - | - | ## Scales diff --git a/packages/components/spacings/spacings-inset/src/inset.tsx b/packages/components/spacings/spacings-inset/src/inset.tsx index 17054f7c3c..457766d27a 100644 --- a/packages/components/spacings/spacings-inset/src/inset.tsx +++ b/packages/components/spacings/spacings-inset/src/inset.tsx @@ -24,6 +24,7 @@ const getPadding = (scale?: TScale) => { export type TInsetProps = { scale: TScale; + height: 'auto' | '100%'; children?: ReactNode; }; @@ -31,15 +32,16 @@ const Inset = (props: TInsetProps) => (
{props.children}
); -const defaultProps: Pick = { +const defaultProps: Pick = { scale: 'm', + height: 'auto', }; Inset.displayName = 'Inset'; Inset.defaultProps = defaultProps;