@gem-sdk/components 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -134,6 +134,140 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
134
134
|
tablet: helpers$1.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
|
|
135
135
|
mobile: helpers$1.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
|
|
136
136
|
};
|
|
137
|
+
const renderInnerHeroBanner = ()=>{
|
|
138
|
+
return core.template /* liquid */ `
|
|
139
|
+
<div
|
|
140
|
+
class="${core.cls('gp-relative gp-flex gp-flex-col gp-items-center gp-overflow-hidden gp_haslazybg', {
|
|
141
|
+
...common.getClassContentPosition(contentPosition || {})
|
|
142
|
+
})}"
|
|
143
|
+
style="${{
|
|
144
|
+
...styleHeight,
|
|
145
|
+
...styleAspectRatio,
|
|
146
|
+
...core.makeStyle({
|
|
147
|
+
bs: borderBg?.border ?? borderBg?.border,
|
|
148
|
+
bw: borderBg?.width ?? borderBg?.width,
|
|
149
|
+
bc: core.getSingleColorVariable(borderBg?.color)
|
|
150
|
+
}),
|
|
151
|
+
...core.getRadiusStyleActiveState({
|
|
152
|
+
...cornerBg,
|
|
153
|
+
active: {
|
|
154
|
+
...cornerBg || {},
|
|
155
|
+
radiusType: 'custom'
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
...background ? {
|
|
159
|
+
...core.getStyleBgColor(background)
|
|
160
|
+
} : {},
|
|
161
|
+
...core.getGradientBgrStyleByDevice(background, bgiEnableByDevice),
|
|
162
|
+
...core.getStyleShadow({
|
|
163
|
+
value: shadowBg,
|
|
164
|
+
styleAppliedFor: 'box-shadow',
|
|
165
|
+
isEnableShadow: hasActiveShadow
|
|
166
|
+
})
|
|
167
|
+
}}"
|
|
168
|
+
>
|
|
169
|
+
${AdaptiveImage_liquid.default({
|
|
170
|
+
priority: setting?.preload,
|
|
171
|
+
pictureClass: 'gp-w-full',
|
|
172
|
+
srcSet: srcSet,
|
|
173
|
+
className: `adaptive-hero-banner`,
|
|
174
|
+
aspectRatio: core.getAspectRatioGlobalSize(sizeSetting),
|
|
175
|
+
style: {
|
|
176
|
+
...common.getDisplayStyleByFitContent(sizeSetting, background),
|
|
177
|
+
...styleHeight,
|
|
178
|
+
...styleWidthShapeOriginal,
|
|
179
|
+
...styleWidth,
|
|
180
|
+
'--op': 0,
|
|
181
|
+
'--z': -1
|
|
182
|
+
},
|
|
183
|
+
alt,
|
|
184
|
+
title,
|
|
185
|
+
imagePlaceholder,
|
|
186
|
+
enableLazyloadImage
|
|
187
|
+
})}
|
|
188
|
+
<div class="${core.cls('gp-absolute gp-w-full gp-h-full')}">
|
|
189
|
+
<div
|
|
190
|
+
class="${core.cls('gp-overflow-hidden gp-relative gp-w-full gp-h-full')}"
|
|
191
|
+
>
|
|
192
|
+
<div
|
|
193
|
+
aria-label="Background Image"
|
|
194
|
+
role="banner"
|
|
195
|
+
class='gp-hero-banner-bg gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0'
|
|
196
|
+
style="${{
|
|
197
|
+
'clip-path': index.getClipPath(borderBg?.width, cornerBg)
|
|
198
|
+
}}"
|
|
199
|
+
>
|
|
200
|
+
<div class="${core.cls('hero-banner-bg-parallax gp-hero-banner-image-background gp_lazybg', {
|
|
201
|
+
'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
|
|
202
|
+
'gp-transition-transform': hoverEffect
|
|
203
|
+
})}"
|
|
204
|
+
style="${{
|
|
205
|
+
...core.getStyleBackgroundByDevice(background, {
|
|
206
|
+
ignoreBgAttachment: true,
|
|
207
|
+
ignoreBackgroundImage: true,
|
|
208
|
+
liquid: true
|
|
209
|
+
}),
|
|
210
|
+
...core.makeStyleResponsive('bgi', {
|
|
211
|
+
desktop: `url('${bgiEnableByDevice['desktop'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
|
|
212
|
+
tablet: `url('${bgiEnableByDevice['tablet'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
|
|
213
|
+
mobile: `url('${bgiEnableByDevice['mobile'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
|
|
214
|
+
}),
|
|
215
|
+
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
216
|
+
'--scale': hoverEffectScale ?? 1,
|
|
217
|
+
...core.makeStyleResponsive('pos', getAttachmentDevice()),
|
|
218
|
+
...index.getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
|
|
219
|
+
}}"
|
|
220
|
+
>
|
|
221
|
+
${!setting?.preload ? getSrcSet.DEVICES.map((device)=>{
|
|
222
|
+
return core.RenderIf(getEnableBgImageByDevice(device), NextImage_liquid.default({
|
|
223
|
+
src: getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device),
|
|
224
|
+
alt: `lazy image ${device}`,
|
|
225
|
+
className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
|
|
226
|
+
isDisableAspectStyle: true,
|
|
227
|
+
enableLazyloadImage
|
|
228
|
+
}));
|
|
229
|
+
}).join('') : ''}
|
|
230
|
+
</div>
|
|
231
|
+
${embed()} </div>
|
|
232
|
+
</div>
|
|
233
|
+
${core.RenderIf(overlayEnable, core.template`<div
|
|
234
|
+
aria-label="Overlay"
|
|
235
|
+
role="banner"
|
|
236
|
+
class="${core.cls('gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-transition-all gp-duration-300 group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]', core.getGlobalColorStateClass('bg', overlayColor))}"
|
|
237
|
+
style="${{
|
|
238
|
+
...core.getGlobalColorStateStyle('bgc', overlayColor),
|
|
239
|
+
'--top': 0,
|
|
240
|
+
'--left': 0,
|
|
241
|
+
...core.makeStyleState('op', overlayOpacity)
|
|
242
|
+
}}">
|
|
243
|
+
</div>`)}
|
|
244
|
+
</div>
|
|
245
|
+
${Row_liquid.default({
|
|
246
|
+
className: core.cls('gp-hero-banner-row gp-z-1 gp-w-full', common.getClassForContentByFitContent(sizeSetting, background), common.getClassForStretchContent(verticalAlign), common.getClassSpaceBetween(setting?.layout || {}, styles?.contentPosition1Col || {}, styles?.contentPosition2Col || {})),
|
|
247
|
+
setting: {
|
|
248
|
+
layout,
|
|
249
|
+
horizontalAlign: rowHorizontalAlign,
|
|
250
|
+
verticalAlign,
|
|
251
|
+
order
|
|
252
|
+
},
|
|
253
|
+
styles: {
|
|
254
|
+
verticalGutter,
|
|
255
|
+
width: common.getWidth(contentWidth),
|
|
256
|
+
fullWidth: {
|
|
257
|
+
desktop: false,
|
|
258
|
+
tablet: false,
|
|
259
|
+
mobile: false
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
style: {
|
|
263
|
+
...contentPaddingStyle
|
|
264
|
+
},
|
|
265
|
+
children,
|
|
266
|
+
rawChildren
|
|
267
|
+
})}
|
|
268
|
+
</div>
|
|
269
|
+
`;
|
|
270
|
+
};
|
|
137
271
|
return core.template`
|
|
138
272
|
<div class="${core.cls('gp-flex gp-w-full', common.getClassJustify(alignBannerData))}" style="${{
|
|
139
273
|
...styleHeight,
|
|
@@ -142,6 +276,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
142
276
|
}}">
|
|
143
277
|
<gp-hero-banner
|
|
144
278
|
gp-data='${core.dataStringify({
|
|
279
|
+
target: urlData?.target ?? '_blank',
|
|
145
280
|
background: backgroundResponsive,
|
|
146
281
|
uid: builderProps?.uid,
|
|
147
282
|
enableParallax,
|
|
@@ -153,6 +288,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
153
288
|
contentPosition2Col: styles?.contentPosition2Col,
|
|
154
289
|
aspectRatio: setting?.aspectRatio
|
|
155
290
|
}).replaceAll("'", ''')}'
|
|
291
|
+
gp-href="${urlData.href}"
|
|
156
292
|
${{
|
|
157
293
|
...builderAttrs
|
|
158
294
|
}}
|
|
@@ -166,145 +302,19 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
166
302
|
}}"
|
|
167
303
|
data-id="${builderProps?.uid}"
|
|
168
304
|
>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
bw: borderBg?.width ?? borderBg?.width,
|
|
179
|
-
bc: core.getSingleColorVariable(borderBg?.color)
|
|
180
|
-
}),
|
|
181
|
-
...core.getRadiusStyleActiveState({
|
|
182
|
-
...cornerBg,
|
|
183
|
-
active: {
|
|
184
|
-
...cornerBg || {},
|
|
185
|
-
radiusType: 'custom'
|
|
186
|
-
}
|
|
187
|
-
}),
|
|
188
|
-
...background ? {
|
|
189
|
-
...core.getStyleBgColor(background)
|
|
190
|
-
} : {},
|
|
191
|
-
...core.getGradientBgrStyleByDevice(background, bgiEnableByDevice),
|
|
192
|
-
...core.getStyleShadow({
|
|
193
|
-
value: shadowBg,
|
|
194
|
-
styleAppliedFor: 'box-shadow',
|
|
195
|
-
isEnableShadow: hasActiveShadow
|
|
196
|
-
})
|
|
197
|
-
}}"
|
|
198
|
-
>
|
|
199
|
-
${AdaptiveImage_liquid.default({
|
|
200
|
-
priority: setting?.preload,
|
|
201
|
-
pictureClass: 'gp-w-full',
|
|
202
|
-
srcSet: srcSet,
|
|
203
|
-
className: `adaptive-hero-banner`,
|
|
204
|
-
aspectRatio: core.getAspectRatioGlobalSize(sizeSetting),
|
|
205
|
-
style: {
|
|
206
|
-
...common.getDisplayStyleByFitContent(sizeSetting, background),
|
|
207
|
-
...styleHeight,
|
|
208
|
-
...styleWidthShapeOriginal,
|
|
209
|
-
...styleWidth,
|
|
210
|
-
'--op': 0,
|
|
211
|
-
'--z': -1
|
|
212
|
-
},
|
|
213
|
-
alt,
|
|
214
|
-
title,
|
|
215
|
-
imagePlaceholder,
|
|
216
|
-
enableLazyloadImage
|
|
217
|
-
})}
|
|
218
|
-
<div class="${core.cls('gp-absolute gp-w-full gp-h-full')}">
|
|
219
|
-
<div
|
|
220
|
-
class="${core.cls('gp-overflow-hidden gp-relative gp-w-full gp-h-full')}"
|
|
221
|
-
>
|
|
222
|
-
<div
|
|
223
|
-
aria-label="Background Image"
|
|
224
|
-
role="banner"
|
|
225
|
-
class='gp-hero-banner-bg gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0'
|
|
226
|
-
style="${{
|
|
227
|
-
'clip-path': index.getClipPath(borderBg?.width, cornerBg)
|
|
228
|
-
}}"
|
|
229
|
-
>
|
|
230
|
-
<div class="${core.cls('hero-banner-bg-parallax gp-hero-banner-image-background gp_lazybg', {
|
|
231
|
-
'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
|
|
232
|
-
'gp-transition-transform': hoverEffect
|
|
233
|
-
})}"
|
|
234
|
-
style="${{
|
|
235
|
-
...core.getStyleBackgroundByDevice(background, {
|
|
236
|
-
ignoreBgAttachment: true,
|
|
237
|
-
ignoreBackgroundImage: true,
|
|
238
|
-
liquid: true
|
|
239
|
-
}),
|
|
240
|
-
...core.makeStyleResponsive('bgi', {
|
|
241
|
-
desktop: `url('${bgiEnableByDevice['desktop'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
|
|
242
|
-
tablet: `url('${bgiEnableByDevice['tablet'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
|
|
243
|
-
mobile: `url('${bgiEnableByDevice['mobile'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
|
|
244
|
-
}),
|
|
245
|
-
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
246
|
-
'--scale': hoverEffectScale ?? 1,
|
|
247
|
-
...core.makeStyleResponsive('pos', getAttachmentDevice()),
|
|
248
|
-
...index.getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
|
|
249
|
-
}}"
|
|
250
|
-
>
|
|
251
|
-
${!setting?.preload ? getSrcSet.DEVICES.map((device)=>{
|
|
252
|
-
return core.RenderIf(getEnableBgImageByDevice(device), NextImage_liquid.default({
|
|
253
|
-
src: getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device),
|
|
254
|
-
alt: `lazy image ${device}`,
|
|
255
|
-
className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
|
|
256
|
-
isDisableAspectStyle: true,
|
|
257
|
-
enableLazyloadImage
|
|
258
|
-
}));
|
|
259
|
-
}).join('') : ''}
|
|
260
|
-
</div>
|
|
261
|
-
${embed()} </div>
|
|
262
|
-
</div>
|
|
263
|
-
${core.RenderIf(overlayEnable, core.template`<div
|
|
264
|
-
aria-label="Overlay"
|
|
265
|
-
role="banner"
|
|
266
|
-
class="${core.cls('gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-transition-all gp-duration-300 group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]', core.getGlobalColorStateClass('bg', overlayColor))}"
|
|
267
|
-
style="${{
|
|
268
|
-
...core.getGlobalColorStateStyle('bgc', overlayColor),
|
|
269
|
-
'--top': 0,
|
|
270
|
-
'--left': 0,
|
|
271
|
-
...core.makeStyleState('op', overlayOpacity)
|
|
272
|
-
}}"
|
|
273
|
-
> </div>`)}
|
|
274
|
-
</div>
|
|
275
|
-
${core.RenderIf(!!link?.link, `<a
|
|
276
|
-
href="${urlData?.href}"
|
|
277
|
-
target="${urlData?.target}"
|
|
278
|
-
aria-label="Hero banner link"
|
|
279
|
-
class="gp-absolute gp-inset-0 gp-z-1"
|
|
280
|
-
> </a>`)}
|
|
281
|
-
${Row_liquid.default({
|
|
282
|
-
className: core.cls('gp-hero-banner-row gp-z-1 gp-w-full', common.getClassForContentByFitContent(sizeSetting, background), common.getClassForStretchContent(verticalAlign), common.getClassSpaceBetween(setting?.layout || {}, styles?.contentPosition1Col || {}, styles?.contentPosition2Col || {})),
|
|
283
|
-
setting: {
|
|
284
|
-
layout,
|
|
285
|
-
horizontalAlign: rowHorizontalAlign,
|
|
286
|
-
verticalAlign,
|
|
287
|
-
order
|
|
288
|
-
},
|
|
289
|
-
styles: {
|
|
290
|
-
verticalGutter,
|
|
291
|
-
width: common.getWidth(contentWidth),
|
|
292
|
-
fullWidth: {
|
|
293
|
-
desktop: false,
|
|
294
|
-
tablet: false,
|
|
295
|
-
mobile: false
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
style: {
|
|
299
|
-
...contentPaddingStyle
|
|
300
|
-
},
|
|
301
|
-
children,
|
|
302
|
-
rawChildren
|
|
303
|
-
})}
|
|
304
|
-
</div>
|
|
305
|
+
${core.RenderIf(!link?.link, renderInnerHeroBanner())}
|
|
306
|
+
${core.RenderIf(!!link?.link, core.template /* liquid */ `
|
|
307
|
+
<div
|
|
308
|
+
data-hero-banner-link="true"
|
|
309
|
+
aria-label="Hero banner link"
|
|
310
|
+
class="${core.cls(link?.link ? 'gp-cursor-pointer' : '')}"
|
|
311
|
+
>
|
|
312
|
+
${renderInnerHeroBanner()}
|
|
313
|
+
</div>`)}
|
|
305
314
|
</gp-hero-banner>
|
|
306
315
|
</div>
|
|
307
|
-
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-hero-banner.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-hero-banner.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script
|
|
316
|
+
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-hero-banner.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-hero-banner.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>
|
|
317
|
+
`)}
|
|
308
318
|
`;
|
|
309
319
|
};
|
|
310
320
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { makeStyleResponsive, getHeightByShapeGlobalSize, makeStyleWithDefault, getWidthByShapeGlobalSize, getPaddingGlobalSize, removeUndefinedValuesFromObject, template, cls, dataStringify, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleBgColor, getGradientBgrStyleByDevice, getStyleShadow, getAspectRatioGlobalSize, getStyleBackgroundByDevice,
|
|
1
|
+
import { makeStyleResponsive, getHeightByShapeGlobalSize, makeStyleWithDefault, getWidthByShapeGlobalSize, getPaddingGlobalSize, removeUndefinedValuesFromObject, template, cls, dataStringify, RenderIf, isLocalEnv, baseAssetURL, getResponsiveValueByScreen, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleBgColor, getGradientBgrStyleByDevice, getStyleShadow, getAspectRatioGlobalSize, getStyleBackgroundByDevice, getGlobalColorStateClass, getGlobalColorStateStyle, makeStyleState } from '@gem-sdk/core';
|
|
2
2
|
import Row from '../../../grid/components/Row.liquid.js';
|
|
3
3
|
import AdaptiveImage from '../../../image/components/AdaptiveImage.liquid.js';
|
|
4
|
-
import { getVisibilityStyle, getMarginStyle, getStyleAspectRatioHeroBannerCustom, removeMarginStyle, getContentPosition, mapContentPositionToHorizontal, getClassJustify, getClassContentPosition, getDisplayStyleByFitContent, getClassForContentByFitContent, getClassForStretchContent, getClassSpaceBetween, getWidth,
|
|
4
|
+
import { getVisibilityStyle, getMarginStyle, getStyleAspectRatioHeroBannerCustom, removeMarginStyle, getContentPosition, mapContentPositionToHorizontal, getClassJustify, getResponsiveSetting, getClassContentPosition, getDisplayStyleByFitContent, getClassForContentByFitContent, getClassForStretchContent, getClassSpaceBetween, getWidth, getBgImage } from '../../helpers/common.js';
|
|
5
5
|
import { getInsertLinkData, getSettingPreloadData } from '../../../helpers.js';
|
|
6
6
|
import HTML5Embed from '../../../video/components/HTML5Embed.liquid.js';
|
|
7
7
|
import { getClipPath, getStyleHeroBannerBg } from './utils/index.js';
|
|
@@ -130,6 +130,140 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
130
130
|
tablet: createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
|
|
131
131
|
mobile: createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
|
|
132
132
|
};
|
|
133
|
+
const renderInnerHeroBanner = ()=>{
|
|
134
|
+
return template /* liquid */ `
|
|
135
|
+
<div
|
|
136
|
+
class="${cls('gp-relative gp-flex gp-flex-col gp-items-center gp-overflow-hidden gp_haslazybg', {
|
|
137
|
+
...getClassContentPosition(contentPosition || {})
|
|
138
|
+
})}"
|
|
139
|
+
style="${{
|
|
140
|
+
...styleHeight,
|
|
141
|
+
...styleAspectRatio,
|
|
142
|
+
...makeStyle({
|
|
143
|
+
bs: borderBg?.border ?? borderBg?.border,
|
|
144
|
+
bw: borderBg?.width ?? borderBg?.width,
|
|
145
|
+
bc: getSingleColorVariable(borderBg?.color)
|
|
146
|
+
}),
|
|
147
|
+
...getRadiusStyleActiveState({
|
|
148
|
+
...cornerBg,
|
|
149
|
+
active: {
|
|
150
|
+
...cornerBg || {},
|
|
151
|
+
radiusType: 'custom'
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
...background ? {
|
|
155
|
+
...getStyleBgColor(background)
|
|
156
|
+
} : {},
|
|
157
|
+
...getGradientBgrStyleByDevice(background, bgiEnableByDevice),
|
|
158
|
+
...getStyleShadow({
|
|
159
|
+
value: shadowBg,
|
|
160
|
+
styleAppliedFor: 'box-shadow',
|
|
161
|
+
isEnableShadow: hasActiveShadow
|
|
162
|
+
})
|
|
163
|
+
}}"
|
|
164
|
+
>
|
|
165
|
+
${AdaptiveImage({
|
|
166
|
+
priority: setting?.preload,
|
|
167
|
+
pictureClass: 'gp-w-full',
|
|
168
|
+
srcSet: srcSet,
|
|
169
|
+
className: `adaptive-hero-banner`,
|
|
170
|
+
aspectRatio: getAspectRatioGlobalSize(sizeSetting),
|
|
171
|
+
style: {
|
|
172
|
+
...getDisplayStyleByFitContent(sizeSetting, background),
|
|
173
|
+
...styleHeight,
|
|
174
|
+
...styleWidthShapeOriginal,
|
|
175
|
+
...styleWidth,
|
|
176
|
+
'--op': 0,
|
|
177
|
+
'--z': -1
|
|
178
|
+
},
|
|
179
|
+
alt,
|
|
180
|
+
title,
|
|
181
|
+
imagePlaceholder,
|
|
182
|
+
enableLazyloadImage
|
|
183
|
+
})}
|
|
184
|
+
<div class="${cls('gp-absolute gp-w-full gp-h-full')}">
|
|
185
|
+
<div
|
|
186
|
+
class="${cls('gp-overflow-hidden gp-relative gp-w-full gp-h-full')}"
|
|
187
|
+
>
|
|
188
|
+
<div
|
|
189
|
+
aria-label="Background Image"
|
|
190
|
+
role="banner"
|
|
191
|
+
class='gp-hero-banner-bg gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0'
|
|
192
|
+
style="${{
|
|
193
|
+
'clip-path': getClipPath(borderBg?.width, cornerBg)
|
|
194
|
+
}}"
|
|
195
|
+
>
|
|
196
|
+
<div class="${cls('hero-banner-bg-parallax gp-hero-banner-image-background gp_lazybg', {
|
|
197
|
+
'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
|
|
198
|
+
'gp-transition-transform': hoverEffect
|
|
199
|
+
})}"
|
|
200
|
+
style="${{
|
|
201
|
+
...getStyleBackgroundByDevice(background, {
|
|
202
|
+
ignoreBgAttachment: true,
|
|
203
|
+
ignoreBackgroundImage: true,
|
|
204
|
+
liquid: true
|
|
205
|
+
}),
|
|
206
|
+
...makeStyleResponsive('bgi', {
|
|
207
|
+
desktop: `url('${bgiEnableByDevice['desktop'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
|
|
208
|
+
tablet: `url('${bgiEnableByDevice['tablet'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
|
|
209
|
+
mobile: `url('${bgiEnableByDevice['mobile'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
|
|
210
|
+
}),
|
|
211
|
+
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
212
|
+
'--scale': hoverEffectScale ?? 1,
|
|
213
|
+
...makeStyleResponsive('pos', getAttachmentDevice()),
|
|
214
|
+
...getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
|
|
215
|
+
}}"
|
|
216
|
+
>
|
|
217
|
+
${!setting?.preload ? DEVICES.map((device)=>{
|
|
218
|
+
return RenderIf(getEnableBgImageByDevice(device), NextImage({
|
|
219
|
+
src: getImageSrc(getResponsiveValueByScreen(srcSet, device), device),
|
|
220
|
+
alt: `lazy image ${device}`,
|
|
221
|
+
className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
|
|
222
|
+
isDisableAspectStyle: true,
|
|
223
|
+
enableLazyloadImage
|
|
224
|
+
}));
|
|
225
|
+
}).join('') : ''}
|
|
226
|
+
</div>
|
|
227
|
+
${embed()} </div>
|
|
228
|
+
</div>
|
|
229
|
+
${RenderIf(overlayEnable, template`<div
|
|
230
|
+
aria-label="Overlay"
|
|
231
|
+
role="banner"
|
|
232
|
+
class="${cls('gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-transition-all gp-duration-300 group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]', getGlobalColorStateClass('bg', overlayColor))}"
|
|
233
|
+
style="${{
|
|
234
|
+
...getGlobalColorStateStyle('bgc', overlayColor),
|
|
235
|
+
'--top': 0,
|
|
236
|
+
'--left': 0,
|
|
237
|
+
...makeStyleState('op', overlayOpacity)
|
|
238
|
+
}}">
|
|
239
|
+
</div>`)}
|
|
240
|
+
</div>
|
|
241
|
+
${Row({
|
|
242
|
+
className: cls('gp-hero-banner-row gp-z-1 gp-w-full', getClassForContentByFitContent(sizeSetting, background), getClassForStretchContent(verticalAlign), getClassSpaceBetween(setting?.layout || {}, styles?.contentPosition1Col || {}, styles?.contentPosition2Col || {})),
|
|
243
|
+
setting: {
|
|
244
|
+
layout,
|
|
245
|
+
horizontalAlign: rowHorizontalAlign,
|
|
246
|
+
verticalAlign,
|
|
247
|
+
order
|
|
248
|
+
},
|
|
249
|
+
styles: {
|
|
250
|
+
verticalGutter,
|
|
251
|
+
width: getWidth(contentWidth),
|
|
252
|
+
fullWidth: {
|
|
253
|
+
desktop: false,
|
|
254
|
+
tablet: false,
|
|
255
|
+
mobile: false
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
style: {
|
|
259
|
+
...contentPaddingStyle
|
|
260
|
+
},
|
|
261
|
+
children,
|
|
262
|
+
rawChildren
|
|
263
|
+
})}
|
|
264
|
+
</div>
|
|
265
|
+
`;
|
|
266
|
+
};
|
|
133
267
|
return template`
|
|
134
268
|
<div class="${cls('gp-flex gp-w-full', getClassJustify(alignBannerData))}" style="${{
|
|
135
269
|
...styleHeight,
|
|
@@ -138,6 +272,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
138
272
|
}}">
|
|
139
273
|
<gp-hero-banner
|
|
140
274
|
gp-data='${dataStringify({
|
|
275
|
+
target: urlData?.target ?? '_blank',
|
|
141
276
|
background: backgroundResponsive,
|
|
142
277
|
uid: builderProps?.uid,
|
|
143
278
|
enableParallax,
|
|
@@ -149,6 +284,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
149
284
|
contentPosition2Col: styles?.contentPosition2Col,
|
|
150
285
|
aspectRatio: setting?.aspectRatio
|
|
151
286
|
}).replaceAll("'", ''')}'
|
|
287
|
+
gp-href="${urlData.href}"
|
|
152
288
|
${{
|
|
153
289
|
...builderAttrs
|
|
154
290
|
}}
|
|
@@ -162,145 +298,19 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
162
298
|
}}"
|
|
163
299
|
data-id="${builderProps?.uid}"
|
|
164
300
|
>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
bw: borderBg?.width ?? borderBg?.width,
|
|
175
|
-
bc: getSingleColorVariable(borderBg?.color)
|
|
176
|
-
}),
|
|
177
|
-
...getRadiusStyleActiveState({
|
|
178
|
-
...cornerBg,
|
|
179
|
-
active: {
|
|
180
|
-
...cornerBg || {},
|
|
181
|
-
radiusType: 'custom'
|
|
182
|
-
}
|
|
183
|
-
}),
|
|
184
|
-
...background ? {
|
|
185
|
-
...getStyleBgColor(background)
|
|
186
|
-
} : {},
|
|
187
|
-
...getGradientBgrStyleByDevice(background, bgiEnableByDevice),
|
|
188
|
-
...getStyleShadow({
|
|
189
|
-
value: shadowBg,
|
|
190
|
-
styleAppliedFor: 'box-shadow',
|
|
191
|
-
isEnableShadow: hasActiveShadow
|
|
192
|
-
})
|
|
193
|
-
}}"
|
|
194
|
-
>
|
|
195
|
-
${AdaptiveImage({
|
|
196
|
-
priority: setting?.preload,
|
|
197
|
-
pictureClass: 'gp-w-full',
|
|
198
|
-
srcSet: srcSet,
|
|
199
|
-
className: `adaptive-hero-banner`,
|
|
200
|
-
aspectRatio: getAspectRatioGlobalSize(sizeSetting),
|
|
201
|
-
style: {
|
|
202
|
-
...getDisplayStyleByFitContent(sizeSetting, background),
|
|
203
|
-
...styleHeight,
|
|
204
|
-
...styleWidthShapeOriginal,
|
|
205
|
-
...styleWidth,
|
|
206
|
-
'--op': 0,
|
|
207
|
-
'--z': -1
|
|
208
|
-
},
|
|
209
|
-
alt,
|
|
210
|
-
title,
|
|
211
|
-
imagePlaceholder,
|
|
212
|
-
enableLazyloadImage
|
|
213
|
-
})}
|
|
214
|
-
<div class="${cls('gp-absolute gp-w-full gp-h-full')}">
|
|
215
|
-
<div
|
|
216
|
-
class="${cls('gp-overflow-hidden gp-relative gp-w-full gp-h-full')}"
|
|
217
|
-
>
|
|
218
|
-
<div
|
|
219
|
-
aria-label="Background Image"
|
|
220
|
-
role="banner"
|
|
221
|
-
class='gp-hero-banner-bg gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0'
|
|
222
|
-
style="${{
|
|
223
|
-
'clip-path': getClipPath(borderBg?.width, cornerBg)
|
|
224
|
-
}}"
|
|
225
|
-
>
|
|
226
|
-
<div class="${cls('hero-banner-bg-parallax gp-hero-banner-image-background gp_lazybg', {
|
|
227
|
-
'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
|
|
228
|
-
'gp-transition-transform': hoverEffect
|
|
229
|
-
})}"
|
|
230
|
-
style="${{
|
|
231
|
-
...getStyleBackgroundByDevice(background, {
|
|
232
|
-
ignoreBgAttachment: true,
|
|
233
|
-
ignoreBackgroundImage: true,
|
|
234
|
-
liquid: true
|
|
235
|
-
}),
|
|
236
|
-
...makeStyleResponsive('bgi', {
|
|
237
|
-
desktop: `url('${bgiEnableByDevice['desktop'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
|
|
238
|
-
tablet: `url('${bgiEnableByDevice['tablet'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
|
|
239
|
-
mobile: `url('${bgiEnableByDevice['mobile'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
|
|
240
|
-
}),
|
|
241
|
-
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
242
|
-
'--scale': hoverEffectScale ?? 1,
|
|
243
|
-
...makeStyleResponsive('pos', getAttachmentDevice()),
|
|
244
|
-
...getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
|
|
245
|
-
}}"
|
|
246
|
-
>
|
|
247
|
-
${!setting?.preload ? DEVICES.map((device)=>{
|
|
248
|
-
return RenderIf(getEnableBgImageByDevice(device), NextImage({
|
|
249
|
-
src: getImageSrc(getResponsiveValueByScreen(srcSet, device), device),
|
|
250
|
-
alt: `lazy image ${device}`,
|
|
251
|
-
className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
|
|
252
|
-
isDisableAspectStyle: true,
|
|
253
|
-
enableLazyloadImage
|
|
254
|
-
}));
|
|
255
|
-
}).join('') : ''}
|
|
256
|
-
</div>
|
|
257
|
-
${embed()} </div>
|
|
258
|
-
</div>
|
|
259
|
-
${RenderIf(overlayEnable, template`<div
|
|
260
|
-
aria-label="Overlay"
|
|
261
|
-
role="banner"
|
|
262
|
-
class="${cls('gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-transition-all gp-duration-300 group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]', getGlobalColorStateClass('bg', overlayColor))}"
|
|
263
|
-
style="${{
|
|
264
|
-
...getGlobalColorStateStyle('bgc', overlayColor),
|
|
265
|
-
'--top': 0,
|
|
266
|
-
'--left': 0,
|
|
267
|
-
...makeStyleState('op', overlayOpacity)
|
|
268
|
-
}}"
|
|
269
|
-
> </div>`)}
|
|
270
|
-
</div>
|
|
271
|
-
${RenderIf(!!link?.link, `<a
|
|
272
|
-
href="${urlData?.href}"
|
|
273
|
-
target="${urlData?.target}"
|
|
274
|
-
aria-label="Hero banner link"
|
|
275
|
-
class="gp-absolute gp-inset-0 gp-z-1"
|
|
276
|
-
> </a>`)}
|
|
277
|
-
${Row({
|
|
278
|
-
className: cls('gp-hero-banner-row gp-z-1 gp-w-full', getClassForContentByFitContent(sizeSetting, background), getClassForStretchContent(verticalAlign), getClassSpaceBetween(setting?.layout || {}, styles?.contentPosition1Col || {}, styles?.contentPosition2Col || {})),
|
|
279
|
-
setting: {
|
|
280
|
-
layout,
|
|
281
|
-
horizontalAlign: rowHorizontalAlign,
|
|
282
|
-
verticalAlign,
|
|
283
|
-
order
|
|
284
|
-
},
|
|
285
|
-
styles: {
|
|
286
|
-
verticalGutter,
|
|
287
|
-
width: getWidth(contentWidth),
|
|
288
|
-
fullWidth: {
|
|
289
|
-
desktop: false,
|
|
290
|
-
tablet: false,
|
|
291
|
-
mobile: false
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
style: {
|
|
295
|
-
...contentPaddingStyle
|
|
296
|
-
},
|
|
297
|
-
children,
|
|
298
|
-
rawChildren
|
|
299
|
-
})}
|
|
300
|
-
</div>
|
|
301
|
+
${RenderIf(!link?.link, renderInnerHeroBanner())}
|
|
302
|
+
${RenderIf(!!link?.link, template /* liquid */ `
|
|
303
|
+
<div
|
|
304
|
+
data-hero-banner-link="true"
|
|
305
|
+
aria-label="Hero banner link"
|
|
306
|
+
class="${cls(link?.link ? 'gp-cursor-pointer' : '')}"
|
|
307
|
+
>
|
|
308
|
+
${renderInnerHeroBanner()}
|
|
309
|
+
</div>`)}
|
|
301
310
|
</gp-hero-banner>
|
|
302
311
|
</div>
|
|
303
|
-
${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-hero-banner.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-hero-banner.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script
|
|
312
|
+
${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-hero-banner.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-hero-banner.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>
|
|
313
|
+
`)}
|
|
304
314
|
`;
|
|
305
315
|
};
|
|
306
316
|
|