Skip to content

Commit a5b6d4d

Browse files
authored
Merge pull request #2216 from tf/hide-gallery-peeks
Add option to hide image gallery peeks
2 parents 055cdd7 + 52a7439 commit a5b6d4d

File tree

7 files changed

+73
-13
lines changed

7 files changed

+73
-13
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
de:
2+
pageflow_scrolled:
3+
editor:
4+
content_elements:
5+
imageGallery:
6+
attributes:
7+
displayPeeks:
8+
label: "Anrisse benachbarter Bilder zeigen"
9+
inline_help: "Teile der benachbarten Bilder als Hinweis auf weitere Inhalte anzeigen."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
en:
2+
pageflow_scrolled:
3+
editor:
4+
content_elements:
5+
imageGallery:
6+
attributes:
7+
displayPeeks:
8+
label: "Display peeks of neighboring images"
9+
inline_help: "Show partial adjacent image previews as navigation cues."

entry_types/scrolled/package/spec/support/stories.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function storiesOfContentElement(module, options) {
7474
}
7575

7676
exampleStories(options).forEach(({
77-
title, seed, requireConsentOptIn, cssRules, parameters = {}
77+
title, seed, requireConsentOptIn, cssRules, parameters
7878
}) => {
7979
const consent = Consent.create();
8080

@@ -189,13 +189,15 @@ function variantsExampleStories({typeName, baseConfiguration, variants}) {
189189
typeName,
190190
name: 'Variants',
191191
examples: variants.map(({
192-
name, permaId, configuration, themeOptions, sectionConfiguration, inlineFileRightsWidgetTypeName
192+
name, permaId, configuration, themeOptions, sectionConfiguration, viewport,
193+
inlineFileRightsWidgetTypeName
193194
}) => ({
194195
name: name,
195196
permaId,
196197
contentElementConfiguration: {...baseConfiguration, ...configuration},
197198
themeOptions,
198199
sectionConfiguration,
200+
viewport,
199201
inlineFileRightsFor: inlineFileRightsWidgetTypeName ? ['audioFiles', 'imageFiles', 'videoFiles'] : [],
200202
widgets: inlineFileRightsWidgetTypeName ? [{
201203
role: 'inlineFileRights',
@@ -242,16 +244,9 @@ function mobileExampleStories({typeName, baseConfiguration}) {
242244
{
243245
name: 'Default',
244246
contentElementConfiguration: baseConfiguration,
247+
viewport: 'phone'
245248
}
246-
],
247-
parameters: {
248-
viewport: {
249-
defaultViewport: 'iphone6'
250-
},
251-
percy: {
252-
widths: [320]
253-
}
254-
}
249+
]
255250
});
256251
}
257252

@@ -308,7 +303,7 @@ function inlineFileRightsStories({typeName, inlineFileRights, baseConfiguration}
308303
}
309304

310305
function exampleStoryGroup({
311-
name, typeName, examples, parameters, consentVendors, inlineFileRightsFor, widgets
306+
name, typeName, examples, viewport, consentVendors, inlineFileRightsFor, widgets
312307
}) {
313308
const defaultSectionConfiguration = {transition: 'scroll', backdrop: {image: '#000'}, fullHeight: false};
314309

@@ -347,7 +342,14 @@ function exampleStoryGroup({
347342
)
348343
}),
349344
requireConsentOptIn: !!consentVendors,
350-
parameters,
345+
parameters: examples[index].viewport === 'phone' ? {
346+
viewport: {
347+
defaultViewport: 'iphone6'
348+
},
349+
percy: {
350+
widths: [320]
351+
}
352+
} : {},
351353
cssRules: themeOptionsCssRules(examples[index].themeOptions)
352354
}));
353355
}

entry_types/scrolled/package/src/contentElements/imageGallery/ImageGallery.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ function Scroller({
140140
{[styles.wide]:
141141
contentElementWidth === contentElementWidths.lg ||
142142
contentElementWidth === contentElementWidths.xl},
143+
{[styles.full]:
144+
contentElementWidth === contentElementWidths.full},
145+
{[styles.clip]: configuration.hidePeeks},
143146
{[styles.customMargin]: customMargin})}>
144147
<div className={styles.leftButton}>
145148
<ScrollButton direction="left"

entry_types/scrolled/package/src/contentElements/imageGallery/ImageGallery.module.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
justify-content: center;
2929
}
3030

31+
.clip {
32+
--overlap: 0px;
33+
}
34+
35+
.full.clip {
36+
--gutter: 0px;
37+
}
38+
3139
.button {
3240
grid-row: 1;
3341
z-index: 2;
@@ -61,6 +69,10 @@
6169
scrollbar-width: none;
6270
}
6371

72+
.clip .items {
73+
clip-path: content-box;
74+
}
75+
6476
.items::-webkit-scrollbar {
6577
display: none;
6678
}

entry_types/scrolled/package/src/contentElements/imageGallery/editor/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ editor.contentElementTypes.register('imageGallery', {
1818
this.view(ItemsListView, {
1919
collection: ItemsCollection.forContentElement(this.model.parent, entry)
2020
});
21+
this.input('displayPeeks', CheckBoxInputView, {
22+
storeInverted: 'hidePeeks'
23+
});
2124
this.input('enableFullscreenOnDesktop', CheckBoxInputView, {
2225
disabledBinding: ['position', 'width'],
2326
disabled: () => contentElement.getWidth() === contentElementWidths.full,

entry_types/scrolled/package/src/contentElements/imageGallery/stories.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import './frontend';
2+
import {contentElementWidths} from 'pageflow-scrolled/frontend';
23
import {storiesOfContentElement, filePermaId} from 'pageflow-scrolled/spec/support/stories';
34

45
storiesOfContentElement(module, {
@@ -43,6 +44,27 @@ storiesOfContentElement(module, {
4344
}
4445
}
4546
},
47+
{
48+
name: 'Full width',
49+
configuration: {
50+
width: contentElementWidths.full
51+
},
52+
viewport: 'phone'
53+
},
54+
{
55+
name: 'Hide peeks',
56+
configuration: {
57+
hidePeeks: true
58+
}
59+
},
60+
{
61+
name: 'Full widths, Hide peeks',
62+
configuration: {
63+
width: contentElementWidths.full,
64+
hidePeeks: true
65+
},
66+
viewport: 'phone'
67+
},
4668
{
4769
name: 'With Captions',
4870
configuration: {

0 commit comments

Comments
 (0)