Skip to content

Commit

Permalink
feat: support inline flex by an inline prop
Browse files Browse the repository at this point in the history
  • Loading branch information
dstoyanoff committed Jul 4, 2023
1 parent 03cebd7 commit 99e1e16
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/system/flex-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { CssProperties, ResponsiveValue } from "./types";

export const createFlex = (props: FlexSystem, theme: BaseTheme): CssProperties[] => {
const { spacing } = theme;
const { direction, center, centerMain, centerCross, gap, justify, align } = props;
const { direction, center, centerMain, centerCross, gap, justify, align, inline } = props;

const centerTransformer: ValueTransformer<"alignItems" | "justifyContent", boolean> = value =>
value ? "center" : undefined;

const responsive = responsiveCssValueFactory(theme);

return [
{ display: "flex" },
{ display: inline ? "inline-flex" : "flex" },
responsive("flexDirection", direction),

responsive("alignItems", align),
Expand All @@ -36,6 +36,7 @@ export const flexPropKeys = getAllPropKeys<FlexSystem>({
justify: true,
gap: true,
direction: true,
inline: true
});

export type FlexSystem = {
Expand Down Expand Up @@ -73,4 +74,9 @@ export type FlexSystem = {
* Applies align-items to the elements. It has lower priority than center/centerMain/centerCross
*/
align?: ResponsiveValue<CssProperties["alignItems"]>;

/**
* Whether to render as inline-flex instead of flex
*/
inline?: ResponsiveValue<boolean>;
};

0 comments on commit 99e1e16

Please sign in to comment.