@designcrowd/library.brand-page 5.18.2-ast-padding-2 → 5.18.2-ast-padding-3
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.
- package/lib/src/{CreatedOnBrandCrowd-de-de-BhukNHvt.js → CreatedOnBrandCrowd-de-de-CmxeG9Mp.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-J6XEVETI.js → CreatedOnBrandCrowd-en-us-DU2ferVk.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BvU6TWqv.js → CreatedOnBrandCrowd-es-es-C9acnq5K.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-RxSp1TrN.js → CreatedOnBrandCrowd-fr-ca-DCQIfvOJ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-RxSp1TrN.js → CreatedOnBrandCrowd-fr-fr-DCQIfvOJ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-YUSMTsSD.js → CreatedOnBrandCrowd-pt-br-CJca3Ftj.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-YUSMTsSD.js → CreatedOnBrandCrowd-pt-pt-CJca3Ftj.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-C2WQvGKH.js → CreatedOnDcom-de-de-CK1AF-P1.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-CNoK8RYq.js → CreatedOnDcom-en-us-JRxNxkr4.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-DJi-cgZ2.js → CreatedOnDcom-es-es-DOYuxaE_.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-ZqSzLPFX.js → CreatedOnDcom-fr-ca-DUPp1-DG.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-mzPOeMde.js → CreatedOnDcom-fr-fr-DJFhu26d.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-Wi0O-8C5.js → CreatedOnDcom-pt-br-B4RwOpm_.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-DqtM6ovg.js → CreatedOnDcom-pt-pt-NPq4tNzp.js} +1 -1
- package/lib/src/brand-page/constants/misc.constants.d.ts +10 -0
- package/lib/src/brand-page/constants/misc.constants.js +18 -0
- package/lib/src/brand-page/utils/migration/migration-16.js +15 -7
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +6 -6
- package/lib/src/brand-page-maker/convertors/banner-align-display-style.convertor.js +7 -1
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-Ci8yD-3n.js → lib-5zQNtOzo.js} +10635 -10624
- package/package.json +1 -1
- package/src/brand-page/constants/misc.constants.ts +22 -0
- package/src/brand-page/utils/migration/migration-16.ts +22 -11
- package/src/brand-page/utils/migration.util.test.ts +45 -0
- package/src/brand-page-maker/constants/config-settings-constant.ts +6 -6
- package/src/brand-page-maker/convertors/banner-align-display-style.convertor.ts +8 -0
package/package.json
CHANGED
|
@@ -58,6 +58,28 @@ export const CONTACT_FORM_LAYOUT_DEFAULT_PADDING: Record<string, number> = {
|
|
|
58
58
|
[ALIGN_RIGHT_FULL_IMAGE]: 0,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Banner: full-bleed display styles (divided + full-width stacked) render the
|
|
63
|
+
* image flush to the section edges, so their top/bottom padding defaults to 0 to
|
|
64
|
+
* match prod — the standard 32 would push the image off the edges. Every other
|
|
65
|
+
* banner style keeps 32. Used by the banner display-style convertor and the
|
|
66
|
+
* migration backfill, mirroring contact-form's per-layout map above.
|
|
67
|
+
*/
|
|
68
|
+
export const BANNER_DEFAULT_PADDING = 32;
|
|
69
|
+
export const BANNER_FULL_BLEED_DISPLAY_STYLES = [
|
|
70
|
+
ALIGN_LEFT_FULL_IMAGE,
|
|
71
|
+
ALIGN_RIGHT_FULL_IMAGE,
|
|
72
|
+
ALIGN_TOP_FULL_IMAGE,
|
|
73
|
+
ALIGN_BOTTOM_FULL_IMAGE,
|
|
74
|
+
ALIGN_MIDDLE_FULL_IMAGE,
|
|
75
|
+
];
|
|
76
|
+
export const bannerDisplayStyleDefaultPadding = (
|
|
77
|
+
displayStyle?: string,
|
|
78
|
+
): number =>
|
|
79
|
+
displayStyle && BANNER_FULL_BLEED_DISPLAY_STYLES.includes(displayStyle)
|
|
80
|
+
? 0
|
|
81
|
+
: BANNER_DEFAULT_PADDING;
|
|
82
|
+
|
|
61
83
|
export const BIG_IMAGE = 'big-image';
|
|
62
84
|
export const MEDIA_ONLY = 'media-only';
|
|
63
85
|
export const COLUMNS = 'columns';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { MigrationData } from '../migration.util';
|
|
2
|
-
import type { ContactFormContent } from '../../models';
|
|
3
|
-
import {
|
|
2
|
+
import type { BannerSectionContent, ContactFormContent } from '../../models';
|
|
3
|
+
import {
|
|
4
|
+
CONTACT_FORM_LAYOUT_DEFAULT_PADDING,
|
|
5
|
+
bannerDisplayStyleDefaultPadding,
|
|
6
|
+
} from '../../constants';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Padding Control backfill (BP-5699 Tier 2, BP-5700 Store): blocks that already
|
|
@@ -16,7 +19,6 @@ const BLOCK_DEFAULT_PADDING: Partial<Record<string, number>> = {
|
|
|
16
19
|
'shapes-section': 32,
|
|
17
20
|
'booking-section': 32,
|
|
18
21
|
'shop-section': 16,
|
|
19
|
-
'banner-section': 32,
|
|
20
22
|
'about-section': 32,
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -27,14 +29,23 @@ export const migration16 = async (
|
|
|
27
29
|
|
|
28
30
|
brandPageModel.pages.forEach((page) => {
|
|
29
31
|
page.contents.forEach((content) => {
|
|
30
|
-
// Contact Form
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
// Contact Form and Banner previously varied their hard-coded spacing by
|
|
33
|
+
// layout/display style (full-bleed image layouts had no outer padding), so
|
|
34
|
+
// they're keyed by that rather than a single per-type value.
|
|
35
|
+
let value: number | undefined;
|
|
36
|
+
|
|
37
|
+
if (content.type === 'contact-form') {
|
|
38
|
+
value =
|
|
39
|
+
CONTACT_FORM_LAYOUT_DEFAULT_PADDING[
|
|
40
|
+
(content as ContactFormContent).layoutStyle ?? ''
|
|
41
|
+
];
|
|
42
|
+
} else if (content.type === 'banner-section') {
|
|
43
|
+
value = bannerDisplayStyleDefaultPadding(
|
|
44
|
+
(content as BannerSectionContent).displayStyle,
|
|
45
|
+
);
|
|
46
|
+
} else {
|
|
47
|
+
value = BLOCK_DEFAULT_PADDING[content.type];
|
|
48
|
+
}
|
|
38
49
|
|
|
39
50
|
if (value === undefined) {
|
|
40
51
|
return;
|
|
@@ -27,6 +27,9 @@ import {
|
|
|
27
27
|
ALIGN_CARD_CENTER_IMAGE,
|
|
28
28
|
ALIGN_LEFT_FULL_IMAGE,
|
|
29
29
|
ALIGN_RIGHT_FULL_IMAGE,
|
|
30
|
+
ALIGN_TOP_FULL_IMAGE,
|
|
31
|
+
ALIGN_BOTTOM_FULL_IMAGE,
|
|
32
|
+
ALIGN_MIDDLE_FULL_IMAGE,
|
|
30
33
|
DEFAULT_LETTER_SPACING,
|
|
31
34
|
LINE_HEIGHT_BODY,
|
|
32
35
|
LINE_HEIGHT_HEADINGS,
|
|
@@ -1528,6 +1531,48 @@ describe('migration.util', () => {
|
|
|
1528
1531
|
expect(content.bottomPadding).toBe(32);
|
|
1529
1532
|
});
|
|
1530
1533
|
|
|
1534
|
+
test('migration16 should backfill 32 padding for standard banner display styles', async () => {
|
|
1535
|
+
const model = await migrateBrandPageModel(getBsModel(), {
|
|
1536
|
+
isUserDraft: false,
|
|
1537
|
+
isServerRender: false,
|
|
1538
|
+
});
|
|
1539
|
+
|
|
1540
|
+
// pages[0].contents[0] is a 'centered' banner (standard, not full-bleed).
|
|
1541
|
+
const banner = model.brandPageModel.pages[0]
|
|
1542
|
+
.contents[0] as BannerSectionContent;
|
|
1543
|
+
|
|
1544
|
+
expect(banner.topPadding).toBe(32);
|
|
1545
|
+
expect(banner.bottomPadding).toBe(32);
|
|
1546
|
+
});
|
|
1547
|
+
|
|
1548
|
+
test.each([
|
|
1549
|
+
[ALIGN_LEFT_FULL_IMAGE],
|
|
1550
|
+
[ALIGN_RIGHT_FULL_IMAGE],
|
|
1551
|
+
[ALIGN_TOP_FULL_IMAGE],
|
|
1552
|
+
[ALIGN_BOTTOM_FULL_IMAGE],
|
|
1553
|
+
[ALIGN_MIDDLE_FULL_IMAGE],
|
|
1554
|
+
])(
|
|
1555
|
+
'migration16 should backfill zero padding for the %s full-bleed banner style',
|
|
1556
|
+
async (displayStyle) => {
|
|
1557
|
+
const brandPageModel = getBsModel();
|
|
1558
|
+
|
|
1559
|
+
(
|
|
1560
|
+
brandPageModel.pages[0].contents[0] as BannerSectionContent
|
|
1561
|
+
).displayStyle = displayStyle;
|
|
1562
|
+
|
|
1563
|
+
const model = await migrateBrandPageModel(brandPageModel, {
|
|
1564
|
+
isUserDraft: false,
|
|
1565
|
+
isServerRender: false,
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1568
|
+
const banner = model.brandPageModel.pages[0]
|
|
1569
|
+
.contents[0] as BannerSectionContent;
|
|
1570
|
+
|
|
1571
|
+
expect(banner.topPadding).toBe(0);
|
|
1572
|
+
expect(banner.bottomPadding).toBe(0);
|
|
1573
|
+
},
|
|
1574
|
+
);
|
|
1575
|
+
|
|
1531
1576
|
test('migrateNewLogoLogic should migrate logoDraftToken and logoVariation', () => {
|
|
1532
1577
|
const oldTemplate: BrandPageData = {
|
|
1533
1578
|
pages: [
|
|
@@ -1308,6 +1308,7 @@ export const TEXT_CONTENT_SETTINGS_CONFIG = (): ContentSettingsConfig<
|
|
|
1308
1308
|
variant: 'icon',
|
|
1309
1309
|
visibilityAssessor: brandSiteTypeVisibilityAssessor,
|
|
1310
1310
|
},
|
|
1311
|
+
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
1311
1312
|
backgroundColor: {
|
|
1312
1313
|
type: 'color',
|
|
1313
1314
|
defaultValue: {},
|
|
@@ -1317,7 +1318,6 @@ export const TEXT_CONTENT_SETTINGS_CONFIG = (): ContentSettingsConfig<
|
|
|
1317
1318
|
valueConvertor: backgroundColorConvertor,
|
|
1318
1319
|
groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.style,
|
|
1319
1320
|
},
|
|
1320
|
-
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
1321
1321
|
},
|
|
1322
1322
|
isEnabled: true,
|
|
1323
1323
|
isLocked: false,
|
|
@@ -2205,6 +2205,7 @@ export const CONTACT_FORM_SETTINGS_CONFIG =
|
|
|
2205
2205
|
variant: 'icon',
|
|
2206
2206
|
visibilityAssessor: brandSiteTypeVisibilityAssessor,
|
|
2207
2207
|
},
|
|
2208
|
+
...PADDING_CONTROL_FIELDS(CONTACT_FORM_GROUPS.style),
|
|
2208
2209
|
titleStyle: DEFAULT_TITLE_STYLE_SETTINGS_FILED_WITH_TITLE(),
|
|
2209
2210
|
descriptionStyle: DEFAULT_DESCRIPTION_STYLE_FILED(),
|
|
2210
2211
|
buttonTextStyle: DEFAULT_BUTTON_TEXT_STYLE_FIELD(),
|
|
@@ -2228,7 +2229,6 @@ export const CONTACT_FORM_SETTINGS_CONFIG =
|
|
|
2228
2229
|
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2229
2230
|
valueConvertor: backgroundColorConvertor,
|
|
2230
2231
|
},
|
|
2231
|
-
...PADDING_CONTROL_FIELDS(CONTACT_FORM_GROUPS.style),
|
|
2232
2232
|
},
|
|
2233
2233
|
isEnabled: true,
|
|
2234
2234
|
isLocked: (features) => !features.canAddContactFormContents,
|
|
@@ -2632,6 +2632,7 @@ export const IMAGES_SECTION_SETTINGS_CONFIG =
|
|
|
2632
2632
|
],
|
|
2633
2633
|
fields: {
|
|
2634
2634
|
displayStyle: TEXT_MEDIA_DISPLAY_STYLE_FIELD(MEDIA_TYPES.image),
|
|
2635
|
+
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
2635
2636
|
aspectRatio: {
|
|
2636
2637
|
type: 'radio',
|
|
2637
2638
|
role: 'multi',
|
|
@@ -2694,7 +2695,6 @@ export const IMAGES_SECTION_SETTINGS_CONFIG =
|
|
|
2694
2695
|
? MAX_BS_MEDIA_AND_IMAGE_ITEMS
|
|
2695
2696
|
: MAX_BP_MEDIA_AND_IMAGE_ITEMS,
|
|
2696
2697
|
},
|
|
2697
|
-
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
2698
2698
|
},
|
|
2699
2699
|
isEnabled: true,
|
|
2700
2700
|
isLocked: false,
|
|
@@ -2832,6 +2832,7 @@ export const SOCIAL_LINKS_SETTINGS_CONFIG =
|
|
|
2832
2832
|
optionsConvertor: socialLinksIconDisplayStyleConvertor,
|
|
2833
2833
|
variant: 'icon',
|
|
2834
2834
|
},
|
|
2835
|
+
...PADDING_CONTROL_FIELDS(SOCIAL_LINKS_GROUPS.style),
|
|
2835
2836
|
titleStyle: {
|
|
2836
2837
|
type: 'text-style',
|
|
2837
2838
|
groupId: SOCIAL_LINKS_GROUPS.style,
|
|
@@ -2868,7 +2869,6 @@ export const SOCIAL_LINKS_SETTINGS_CONFIG =
|
|
|
2868
2869
|
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2869
2870
|
valueConvertor: backgroundColorConvertor,
|
|
2870
2871
|
},
|
|
2871
|
-
...PADDING_CONTROL_FIELDS(SOCIAL_LINKS_GROUPS.style),
|
|
2872
2872
|
},
|
|
2873
2873
|
isEnabled: true,
|
|
2874
2874
|
isLocked: false,
|
|
@@ -2945,6 +2945,7 @@ export const SHAPES_SECTION_SETTINGS_CONFIG =
|
|
|
2945
2945
|
],
|
|
2946
2946
|
fields: {
|
|
2947
2947
|
displayStyle: TEXT_MEDIA_DISPLAY_STYLE_FIELD(MEDIA_TYPES.shape),
|
|
2948
|
+
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
2948
2949
|
size: IMAGE_SIZE_FIELD(),
|
|
2949
2950
|
title: TEXT_MEDIA_TITLE_FIELD(),
|
|
2950
2951
|
description: TEXT_MEDIA_DESCRIPTION_FIELD(),
|
|
@@ -3164,7 +3165,6 @@ export const BOOKING_SECTION_SETTINGS_CONFIG =
|
|
|
3164
3165
|
},
|
|
3165
3166
|
],
|
|
3166
3167
|
fields: {
|
|
3167
|
-
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
3168
3168
|
titleStyle: DEFAULT_TITLE_STYLE_SETTINGS_FILED_WITH_TITLE(),
|
|
3169
3169
|
descriptionStyle: DEFAULT_DESCRIPTION_STYLE_FILED(),
|
|
3170
3170
|
buttonTextStyle: DEFAULT_BUTTON_TEXT_STYLE_FIELD(),
|
|
@@ -3208,6 +3208,7 @@ export const BOOKING_SECTION_SETTINGS_CONFIG =
|
|
|
3208
3208
|
visibilityAssessor: (c, b) =>
|
|
3209
3209
|
personalisationOverrideVisibility(c, b, 'buttonText'),
|
|
3210
3210
|
},
|
|
3211
|
+
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
3211
3212
|
backgroundStyle: {
|
|
3212
3213
|
type: 'color',
|
|
3213
3214
|
groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.style,
|
|
@@ -3244,7 +3245,6 @@ export const BOOKING_SECTION_SETTINGS_CONFIG =
|
|
|
3244
3245
|
validator: urlValidator,
|
|
3245
3246
|
defaultValue: '',
|
|
3246
3247
|
},
|
|
3247
|
-
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
3248
3248
|
},
|
|
3249
3249
|
isEnabled: true,
|
|
3250
3250
|
isLocked: false,
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
ALIGN_TOP_FULL_IMAGE,
|
|
16
16
|
ALIGN_BOTTOM_FULL_IMAGE,
|
|
17
17
|
ALIGN_MIDDLE_FULL_IMAGE,
|
|
18
|
+
bannerDisplayStyleDefaultPadding,
|
|
18
19
|
} from '@brand-page/constants';
|
|
19
20
|
import type { BannerSectionContent } from '@brand-page';
|
|
20
21
|
|
|
@@ -172,8 +173,15 @@ export const bannerAlignDisplayStyleConvertor: ValueConvertor<
|
|
|
172
173
|
textAlign = 'center';
|
|
173
174
|
}
|
|
174
175
|
|
|
176
|
+
// Switching display style adopts that style's canonical look — like the
|
|
177
|
+
// textAlign resets above — including its default block padding. Full-bleed
|
|
178
|
+
// image styles default to 0 (image flush to the edges); the rest to 32.
|
|
179
|
+
const padding = bannerDisplayStyleDefaultPadding(selectedOption?.value);
|
|
180
|
+
|
|
175
181
|
return {
|
|
176
182
|
displayStyle: selectedOption?.value,
|
|
183
|
+
topPadding: padding,
|
|
184
|
+
bottomPadding: padding,
|
|
177
185
|
titleStyle: {
|
|
178
186
|
textAlign,
|
|
179
187
|
},
|