Skip to content

Commit

Permalink
feat(Box): allow flexShrink prop
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptammergard committed Apr 5, 2023
1 parent f9a359a commit 575c4de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/thick-gifts-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@einride/ui": minor
---

Allow `flexShrink` prop on Box.
8 changes: 7 additions & 1 deletion packages/einride-ui/src/components/layout/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Display,
FlexDirection,
FlexGrow,
FlexShrink,
FlexWrap,
FontFamily,
Gap,
Expand Down Expand Up @@ -77,9 +78,12 @@ export interface BoxProps extends Omit<ComponentPropsWithoutRef<"div">, "color">
/** `flex-direction` CSS property. */
flexDirection?: FlexDirection

/** `flex-direction` CSS property. */
/** `flex-grow` CSS property. */
flexGrow?: FlexGrow

/** `flex-shrink` CSS property. */
flexShrink?: FlexShrink

/** `flex-wrap` CSS property. */
flexWrap?: FlexWrap

Expand Down Expand Up @@ -189,6 +193,7 @@ interface WrapperProps {
display?: Display
flexDirection?: FlexDirection
flexGrow?: FlexGrow
flexShrink?: FlexShrink
flexWrap?: FlexWrap
fontFamily?: FontFamily
gap?: Gap
Expand Down Expand Up @@ -238,6 +243,7 @@ const Wrapper = styled("div", {
display: ${({ display }) => display};
flex-direction: ${({ flexDirection }) => flexDirection};
flex-grow: ${({ flexGrow }) => flexGrow};
flex-shrink: ${({ flexShrink }) => flexShrink};
flex-wrap: ${({ flexWrap }) => flexWrap};
font-family: ${({ fontFamily, theme }) => fontFamily && getFont(fontFamily, theme)};
gap: ${({ gap, theme }) => gap && getSpacing(gap, theme)};
Expand Down
1 change: 1 addition & 0 deletions packages/einride-ui/src/lib/theme/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type Color = ContentColor | Omit<string, ContentColor>
export type Display = CSSProperties["display"]
export type FlexDirection = CSSProperties["flexDirection"]
export type FlexGrow = CSSProperties["flexGrow"]
export type FlexShrink = CSSProperties["flexShrink"]
export type FlexWrap = CSSProperties["flexWrap"]
export type FontFamily = Font | Omit<string, Font>
export type FontSize = FontSizeType | Omit<string, FontSizeType> | number
Expand Down

0 comments on commit 575c4de

Please sign in to comment.