Skip to content

Commit 2d58c8b

Browse files
committed
feat(Flex): added gap and column-gap responsive props
1 parent e298873 commit 2d58c8b

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

apps/docs/src/stories/Layouts/Flex.story.vue

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,36 @@
5555
<pf-flex-item>Flex item</pf-flex-item>
5656
</pf-flex>
5757
</story-canvas>
58+
59+
<story-canvas title="Row gap">
60+
<pf-flex gap="2xl">
61+
<pf-flex-item>Flex item</pf-flex-item>
62+
<pf-flex-item>Flex item</pf-flex-item>
63+
<pf-flex-item>Flex item</pf-flex-item>
64+
<pf-flex-item>Flex item</pf-flex-item>
65+
<pf-flex-item>Flex item</pf-flex-item>
66+
<pf-flex-item>Flex item</pf-flex-item>
67+
<pf-flex-item>Flex item</pf-flex-item>
68+
<pf-flex-item>Flex item</pf-flex-item>
69+
<pf-flex-item>Flex item</pf-flex-item>
70+
<pf-flex-item>Flex item</pf-flex-item>
71+
</pf-flex>
72+
</story-canvas>
73+
74+
<story-canvas title="Column gap">
75+
<pf-flex column-gap="2xl">
76+
<pf-flex-item>Flex item</pf-flex-item>
77+
<pf-flex-item>Flex item</pf-flex-item>
78+
<pf-flex-item>Flex item</pf-flex-item>
79+
<pf-flex-item>Flex item</pf-flex-item>
80+
<pf-flex-item>Flex item</pf-flex-item>
81+
<pf-flex-item>Flex item</pf-flex-item>
82+
<pf-flex-item>Flex item</pf-flex-item>
83+
<pf-flex-item>Flex item</pf-flex-item>
84+
<pf-flex-item>Flex item</pf-flex-item>
85+
<pf-flex-item>Flex item</pf-flex-item>
86+
</pf-flex>
87+
</story-canvas>
5888
</doc-page>
5989
</template>
6090

packages/core/src/breakpoints.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ export type SpaceItemsBreakpointProps = {
7070
spaceItemsXl2?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
7171
}
7272

73+
export type GapBreakpointProps = {
74+
gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
75+
gapSm?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
76+
gapMd?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
77+
gapLg?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
78+
gapXl?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
79+
gapXl2?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
80+
}
81+
82+
export type ColumnGapBreakpointProps = {
83+
columnGap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
84+
columnGapSm?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
85+
columnGapMd?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
86+
columnGapLg?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
87+
columnGapXl?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
88+
columnGapXl2?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
89+
}
90+
7391
export type GrowBreakpointProps = {
7492
grow?: boolean;
7593
growSm?: boolean;

packages/core/src/layouts/Flex/Flex.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
'alignContent',
77
'alignItems',
88
'alignSelf',
9+
'columnGap',
910
'flex',
1011
'fullWidth',
12+
'gap',
1113
'grow',
1214
'justifyContent',
1315
'shrink',
@@ -27,7 +29,7 @@
2729
import styles from '@patternfly/react-styles/css/layouts/Flex/flex';
2830
2931
import { classesFromBreakpointProps } from '../../breakpoints';
30-
import type { SpacerBreakpointProps, SpaceItemsBreakpointProps, GrowBreakpointProps, ShrinkBreakpointProps, FlexBreakpointProps, DirectionBreakpointProps, AlignItemsBreakpointProps, AlignContentBreakpointProps, AlignSelfBreakpointProps, AlignBreakpointProps, JustifyContentBreakpointProps, DisplayBreakpointProps, FullWidthBreakpointProps, FlexWrapBreakpointProps } from '../../breakpoints';
32+
import type { SpacerBreakpointProps, SpaceItemsBreakpointProps, GrowBreakpointProps, ShrinkBreakpointProps, FlexBreakpointProps, DirectionBreakpointProps, AlignItemsBreakpointProps, AlignContentBreakpointProps, AlignSelfBreakpointProps, AlignBreakpointProps, JustifyContentBreakpointProps, DisplayBreakpointProps, FullWidthBreakpointProps, FlexWrapBreakpointProps, GapBreakpointProps, ColumnGapBreakpointProps } from '../../breakpoints';
3133
import type { Component, HTMLAttributes } from 'vue';
3234
3335
defineOptions({
@@ -39,11 +41,13 @@ export interface Props extends
3941
AlignContentBreakpointProps,
4042
AlignItemsBreakpointProps,
4143
AlignSelfBreakpointProps,
44+
ColumnGapBreakpointProps,
4245
DirectionBreakpointProps,
4346
DisplayBreakpointProps,
4447
FlexBreakpointProps,
4548
FlexWrapBreakpointProps,
4649
FullWidthBreakpointProps,
50+
GapBreakpointProps,
4751
GrowBreakpointProps,
4852
JustifyContentBreakpointProps,
4953
ShrinkBreakpointProps,

0 commit comments

Comments
 (0)