Skip to content

Commit 1cbf906

Browse files
committed
feat(Gallery): added max-width and min-width responsive props
1 parent 3d0e2bf commit 1cbf906

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,16 @@
2121
<pf-gallery-item>Gallery Item</pf-gallery-item>
2222
</pf-gallery>
2323
</story-canvas>
24+
25+
<story-canvas title="Responsive widths">
26+
<pf-gallery gutter min-width-sm="100px" max-width-2xl="390px">
27+
<pf-gallery-item>Gallery Item</pf-gallery-item>
28+
<pf-gallery-item>Gallery Item</pf-gallery-item>
29+
<pf-gallery-item>Gallery Item</pf-gallery-item>
30+
<pf-gallery-item>Gallery Item</pf-gallery-item>
31+
<pf-gallery-item>Gallery Item</pf-gallery-item>
32+
<pf-gallery-item>Gallery Item</pf-gallery-item>
33+
</pf-gallery>
34+
</story-canvas>
2435
</doc-page>
2536
</template>

packages/core/src/layouts/Gallery/Gallery.vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
<template>
2-
<component :is="component" :class="[styles.gallery, { [styles.modifiers.gutter]: gutter }]">
2+
<component
3+
:is="component"
4+
:class="[styles.gallery, { [styles.modifiers.gutter]: gutter }]"
5+
:style="{
6+
...cssVarsFromBreakpointProps($props, 'minWidth', cssGridTemplateColumnsMin.name),
7+
...cssVarsFromBreakpointProps($props, 'maxWidth', cssGridTemplateColumnsMax.name),
8+
}"
9+
>
310
<slot />
411
</component>
512
</template>
613

714
<script lang="ts" setup>
815
import styles from '@patternfly/react-styles/css/layouts/Gallery/gallery';
16+
import cssGridTemplateColumnsMin from '@patternfly/react-tokens/dist/esm/l_gallery_GridTemplateColumns_min';
17+
import cssGridTemplateColumnsMax from '@patternfly/react-tokens/dist/esm/l_gallery_GridTemplateColumns_max';
18+
919
import type { Component, HTMLAttributes } from 'vue';
20+
import { cssVarsFromBreakpointProps } from '../../breakpoints';
1021
1122
defineOptions({
1223
name: 'PfGallery',
@@ -15,6 +26,32 @@ defineOptions({
1526
export interface Props extends /* @vue-ignore */ HTMLAttributes {
1627
component?: string | Component;
1728
gutter?: boolean;
29+
30+
/** Minimum width */
31+
minWidth?: string;
32+
/** Minimum width at Sm breakpoint */
33+
minWidthSm?: string;
34+
/** Minimum width at Md breakpoint */
35+
minWidthMd?: string;
36+
/** Minimum width at Lg breakpoint */
37+
minWidthLg?: string;
38+
/** Minimum width at Xl breakpoint */
39+
minWidthXl?: string;
40+
/** Minimum width at Xl2 breakpoint */
41+
minWidth2xl?: string;
42+
43+
/** Maximum width */
44+
maxWidth?: string;
45+
/** Maximum width at Sm breakpoint */
46+
maxWidthSm?: string;
47+
/** Maximum width at Md breakpoint */
48+
maxWidthMd?: string;
49+
/** Maximum width at Lg breakpoint */
50+
maxWidthLg?: string;
51+
/** Maximum width at Xl breakpoint */
52+
maxWidthXl?: string;
53+
/** Maximum width at Xl2 breakpoint */
54+
maxWidth2xl?: string;
1855
}
1956
2057
withDefaults(defineProps<Props>(), {

0 commit comments

Comments
 (0)