Skip to content

Commit

Permalink
add margin props to flex item
Browse files Browse the repository at this point in the history
  • Loading branch information
anilanar committed May 16, 2024
1 parent 14aa5ad commit 33969ed
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-baboons-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moblin/chakra-ui": patch
---

add margin props to flex item
6 changes: 4 additions & 2 deletions packages/chakra-ui/src/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
unsafeCoerce,
} from "@moblin/core";

import { ContainerProps } from "./props";
import { ContainerProps, SafeFlexItemProps } from "./props";
import { WithChildren } from "./react";

export interface FlexItemProps extends WithChildren {
export interface FlexItemProps extends WithChildren, SafeFlexItemProps {
alignSelf?: AlignSelf;
grow?: number;
shrink?: number;
Expand All @@ -29,6 +29,7 @@ export const FlexItem = ({
basis = "auto",
children,
overflowAnchor,
...props
}: FlexItemProps) => {
return (
<chakra.div
Expand Down Expand Up @@ -59,6 +60,7 @@ export const FlexItem = ({
},
overflowAnchor,
}}
{...props}
>
{children}
</chakra.div>
Expand Down
28 changes: 28 additions & 0 deletions packages/chakra-ui/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,34 @@ export type SafeSpaceProps = Pick<
| "py"
>;

export type SafeFlexItemProps = Pick<
SpaceProps,
| "m"
| "margin"
| "mt"
| "marginBlockStart"
| "marginTop"
| "mr"
| "marginInlineEnd"
| "marginEnd"
| "me"
| "marginRight"
| "mb"
| "marginBlockEnd"
| "marginBottom"
| "ml"
| "marginInlineStart"
| "marginStart"
| "ms"
| "marginLeft"
| "mx"
| "marginInline"
| "marginX"
| "my"
| "marginBlock"
| "marginY"
>;

export type ContainerProps<T extends As> = Omit<
HTMLChakraProps<T>,
keyof StyleProps
Expand Down

0 comments on commit 33969ed

Please sign in to comment.