@designcrowd/library.brand-page 6.2.0 → 6.2.2-live-preview-1
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-VQCQvlMg.js → CreatedOnBrandCrowd-de-de-Cn0M-eZ1.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-DSf3BjCG.js → CreatedOnBrandCrowd-en-us-DRLMSDZr.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DGcdM9Ec.js → CreatedOnBrandCrowd-es-es-BglTu73U.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-C9g1fc39.js → CreatedOnBrandCrowd-fr-ca-Bj6YZ_el.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-C9g1fc39.js → CreatedOnBrandCrowd-fr-fr-Bj6YZ_el.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DSXr7Bxl.js → CreatedOnBrandCrowd-pt-br-DEoOmQ1F.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DSXr7Bxl.js → CreatedOnBrandCrowd-pt-pt-DEoOmQ1F.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-BPdCL6wS.js → CreatedOnDcom-de-de-BZ7gTt4Z.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-CLkSTQRu.js → CreatedOnDcom-en-us-CD6Km5sH.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CRknMAGv.js → CreatedOnDcom-es-es-CNpZHvEl.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-ClAY_dHI.js → CreatedOnDcom-fr-ca-URS-ydJ1.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DQtv9rR-.js → CreatedOnDcom-fr-fr-D2AVeA3H.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-BbIxvmxv.js → CreatedOnDcom-pt-br-C32frnFs.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BOfOesBj.js → CreatedOnDcom-pt-pt-TDYGjRXS.js} +1 -1
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.d.ts +16 -2
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.js +17 -0
- package/lib/src/brand-page/components/page/Page.mixin.d.ts +2 -1
- package/lib/src/brand-page/components/page/Page.mixin.js +12 -7
- package/lib/src/brand-page/components/page-header/HeaderLayout.stories.d.ts +1 -0
- package/lib/src/brand-page/components/page-header/HeaderLayout.stories.js +9 -0
- package/lib/src/brand-page/components/page-header/PageHeader.mixin.d.ts +3 -1
- package/lib/src/brand-page/components/page-header/PageHeader.mixin.js +10 -4
- package/lib/src/brand-page/constants/sections/header-display.constants.d.ts +3 -0
- package/lib/src/brand-page/constants/sections/header-display.constants.js +15 -0
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +0 -2
- package/lib/src/brand-page/models/brand-page-context.model.js +0 -12
- package/lib/src/brand-page/models/index.d.ts +12 -0
- package/lib/src/brand-page/models/index.js +4 -0
- package/lib/src/brand-page/utils/context.util.d.ts +1 -0
- package/lib/src/brand-page/utils/context.util.js +9 -0
- package/lib/src/brand-page/utils/route.util.d.ts +1 -0
- package/lib/src/brand-page/utils/route.util.js +9 -0
- package/lib/src/brand-page/utils/view-model.util.js +53 -1
- package/lib/src/brand-page/view-models.d.ts +3 -1
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +0 -1
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.js +0 -9
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +9 -44
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +8 -43
- package/lib/src/brand-page-maker/components/preview/Preview.mixin.d.ts +0 -14
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -42
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +0 -42
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +0 -42
- package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +0 -42
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +0 -42
- package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +0 -42
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +3 -0
- package/lib/src/brand-page-maker/composables/useEventTracker.js +10 -0
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +1626 -0
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +0 -42
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +2 -4
- package/lib/src/brand-page-maker/validators/section-button.validator.d.ts +5 -2
- package/lib/src/brand-page-maker/validators/section-button.validator.js +11 -15
- package/lib/src/{bundled-translations-B2q5GWTQ.js → bundled-translations-BYUfWBT3.js} +17 -17
- package/lib/src/{bundled-translations.de-DE-FhH2H_rd.js → bundled-translations.de-DE-MmzUu1tt.js} +21 -21
- package/lib/src/{bundled-translations.es-ES-_ZExxMi7.js → bundled-translations.es-ES-D-tG33XL.js} +5 -5
- package/lib/src/{bundled-translations.fr-CA-Tg-ODIiC.js → bundled-translations.fr-CA-CNc1H1h3.js} +1 -1
- package/lib/src/{bundled-translations.fr-FR-C0sU51Mz.js → bundled-translations.fr-FR-DX0-yepT.js} +9 -9
- package/lib/src/{bundled-translations.pt-BR-MYFIhA4u.js → bundled-translations.pt-BR-ih1-LRgy.js} +9 -9
- package/lib/src/{bundled-translations.pt-PT-DeUBSzCB.js → bundled-translations.pt-PT-Dq2CmD1p.js} +22 -22
- package/lib/src/bundles/bundled-translations.de-DE.json +9 -2
- package/lib/src/bundles/bundled-translations.es-ES.json +9 -2
- package/lib/src/bundles/bundled-translations.fr-CA.json +9 -2
- package/lib/src/bundles/bundled-translations.fr-FR.json +9 -2
- package/lib/src/bundles/bundled-translations.json +9 -2
- package/lib/src/bundles/bundled-translations.pt-BR.json +9 -2
- package/lib/src/bundles/bundled-translations.pt-PT.json +9 -2
- package/lib/src/composables/useTranslate.d.ts +1 -1
- package/lib/src/composables/useTranslate.js +1 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +577 -139
- package/lib/src/css/library.brand-page-brandPage.min.css +577 -139
- package/lib/src/css/library.brand-page-designCom.min.css +577 -139
- package/lib/src/css/library.brand-page-preview.min.css +577 -139
- package/lib/src/index.mjs +2 -2
- package/lib/src/{lib-BMVF4uNy.js → lib-Dm9AuOJL.js} +22487 -21900
- package/lib/src/metadata-builder/builders/item-id-utils.d.ts +2 -0
- package/lib/src/metadata-builder/builders/item-id-utils.js +8 -2
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +10 -2
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +7 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +1 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +6 -1
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +6 -43
- package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +14 -2
- package/lib/src/shared/content-settings/components/text-field/TextField.mixin.js +14 -0
- package/lib/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.d.ts +9 -1
- package/lib/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.js +31 -9
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +1 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +6 -43
- package/lib/src/shared/page-navigation/store/page-navigation-store.d.ts +3 -1
- package/lib/src/shared/page-navigation/store/page-navigation-store.js +34 -9
- package/lib/src/shared/page-settings/components/delete-page-modal/DeletePageModal.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +9 -2
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +200 -44
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.js +12 -35
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +190 -44
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.js +34 -2
- package/lib/src/shared/page-settings/duplicate-page.util.d.ts +4 -0
- package/lib/src/shared/page-settings/duplicate-page.util.js +82 -0
- package/lib/src/shared/page-settings/models.d.ts +1 -0
- package/lib/src/shared/page-settings/store/page-settings-store.d.ts +7 -2
- package/lib/src/shared/page-settings/store/page-settings-store.js +90 -7
- package/lib/src/shared/page-settings/utils.d.ts +3 -0
- package/lib/src/shared/page-settings/utils.js +6 -0
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -56
- package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +0 -42
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +1 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +4 -42
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +1 -0
- package/lib/src/tracker.mjs +1 -1
- package/lib/src/{useEventTracker-C5Ql5p7u.js → useEventTracker-DwPTmzpa.js} +13 -3
- package/package.json +2 -2
- package/src/brand-page/components/navigation/hamburger/HamburgerNavigation.vue +1 -0
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.ts +18 -1
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +73 -3
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue.test.ts +181 -0
- package/src/brand-page/components/page/Page.mixin.ts +21 -11
- package/src/brand-page/components/page/Page.vue +2 -0
- package/src/brand-page/components/page-header/HeaderLayout.stories.ts +10 -0
- package/src/brand-page/components/page-header/HeaderLayout.vue +415 -71
- package/src/brand-page/components/page-header/PageHeader.mixin.ts +14 -10
- package/src/brand-page/components/page-header/PageHeader.vue +16 -1
- package/src/brand-page/components/page-header/PageHeader.vue.test.ts +339 -0
- package/src/brand-page/constants/sections/header-display.constants.test.ts +44 -0
- package/src/brand-page/constants/sections/header-display.constants.ts +35 -0
- package/src/brand-page/models/brand-page-context.model.ts +0 -23
- package/src/brand-page/models/header-button.model.test.ts +85 -0
- package/src/brand-page/models/index.ts +19 -0
- package/src/brand-page/utils/context.util.ts +15 -0
- package/src/brand-page/utils/route.util.ts +13 -0
- package/src/brand-page/utils/view-model.util.test.ts +151 -1
- package/src/brand-page/utils/view-model.util.ts +73 -1
- package/src/brand-page/view-models.ts +3 -0
- package/src/brand-page-maker/components/action-bar/ActionBar.mixin.ts +0 -10
- package/src/brand-page-maker/components/action-bar/ActionBarNavigation.test.ts +8 -49
- package/src/brand-page-maker/components/action-bar/ActionBarNavigation.vue +1 -1
- package/src/brand-page-maker/composables/useEventTracker.ts +13 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +2 -4
- package/src/brand-page-maker/validators/section-button.validator.ts +23 -19
- package/src/bundles/bundled-translations.de-DE.json +9 -2
- package/src/bundles/bundled-translations.es-ES.json +9 -2
- package/src/bundles/bundled-translations.fr-CA.json +9 -2
- package/src/bundles/bundled-translations.fr-FR.json +9 -2
- package/src/bundles/bundled-translations.json +9 -2
- package/src/bundles/bundled-translations.pt-BR.json +9 -2
- package/src/bundles/bundled-translations.pt-PT.json +9 -2
- package/src/composables/useTranslate.ts +2 -1
- package/src/metadata-builder/builders/item-id-utils.ts +9 -2
- package/src/shared/content-settings/components/text-field/TextField.mixin.ts +15 -0
- package/src/shared/content-settings/components/url-field/UrlField.vue +1 -0
- package/src/shared/ecommerce-settings/components/product-config-field/ProductConfigOption.vue +0 -2
- package/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.ts +32 -10
- package/src/shared/page-navigation/store/page-navigation-store.ts +57 -13
- package/src/shared/page-settings/components/header-settings-panel/HeaderSettingsPanel.button-section.test.ts +131 -0
- package/src/shared/page-settings/components/header-settings-panel/HeaderSettingsPanel.vue +65 -10
- package/src/shared/page-settings/components/page-settings/NestedDraggable.vue +3 -0
- package/src/shared/page-settings/components/page-settings/PageElement.vue +2 -0
- package/src/shared/page-settings/components/page-settings/PageSettingMenu.test.ts +105 -0
- package/src/shared/page-settings/components/page-settings/PageSettingMenu.vue +16 -0
- package/src/shared/page-settings/components/page-settings/PageSettings.duplicate.test.ts +108 -0
- package/src/shared/page-settings/components/page-settings/PageSettings.mixin.ts +22 -50
- package/src/shared/page-settings/components/page-settings/PageSettings.vue +1 -0
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.de-DE.json +3 -1
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.es-ES.json +3 -1
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-CA.json +3 -1
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-FR.json +3 -1
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.json +3 -1
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-BR.json +3 -1
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-PT.json +3 -1
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderButtonSettings.test.ts +305 -0
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderButtonSettings.vue +265 -0
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderDisplayStyle.test.ts +354 -0
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderDisplayStyle.vue +48 -9
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.header-button.test.ts +114 -0
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.ts +38 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.de-DE.json +6 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.es-ES.json +6 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.fr-CA.json +6 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.fr-FR.json +6 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.json +6 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.pt-BR.json +6 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.pt-PT.json +6 -1
- package/src/shared/page-settings/duplicate-page.util.test.ts +382 -0
- package/src/shared/page-settings/duplicate-page.util.ts +124 -0
- package/src/shared/page-settings/models.ts +1 -0
- package/src/shared/page-settings/store/page-settings-store.test.ts +441 -1
- package/src/shared/page-settings/store/page-settings-store.ts +147 -11
- package/src/shared/page-settings/utils.ts +10 -0
package/src/shared/page-settings/components/page-settings-section-styles/HeaderDisplayStyle.test.ts
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach } from 'vitest';
|
|
2
|
+
import { createPinia, setActivePinia } from 'pinia';
|
|
3
|
+
import { shallowMount } from '@vue/test-utils';
|
|
4
|
+
import { ButtonGroup } from '@designcrowd/fe-shared-lib';
|
|
5
|
+
import {
|
|
6
|
+
HEADER_DISPLAY,
|
|
7
|
+
HEADER_DISPLAY_STYLE_CONFIGS,
|
|
8
|
+
NAVIGATION_DISPLAY,
|
|
9
|
+
VIEWPORTS,
|
|
10
|
+
} from '@brand-page';
|
|
11
|
+
import type { ViewportsType } from '@brand-page';
|
|
12
|
+
import type { ButtonGroupOption } from '@brand-page-maker/models/button-group.model';
|
|
13
|
+
import { usePageNavigationStore } from '../../../page-navigation/store/page-navigation-store';
|
|
14
|
+
import HeaderDisplayStyle from './HeaderDisplayStyle.vue';
|
|
15
|
+
|
|
16
|
+
// A visible nav needs more than the home page (mirrors route.util.ts hasVisibleNavigation).
|
|
17
|
+
const seedNavPages = (count: number): void => {
|
|
18
|
+
const store = usePageNavigationStore();
|
|
19
|
+
const routes = Array.from({ length: count }, (_, i) => ({
|
|
20
|
+
id: `route-${i}`,
|
|
21
|
+
pageId: `page-${i}`,
|
|
22
|
+
pageSlug: `page-${i}`,
|
|
23
|
+
isHidden: false,
|
|
24
|
+
displayName: `Page ${i}`,
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
store.routes = routes;
|
|
28
|
+
store.orders = routes.map((route) => ({
|
|
29
|
+
routeId: route.id,
|
|
30
|
+
subRoutes: [],
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// The button swaps bar + desktop-hamburger tiles to with-button artwork; mobile hamburger stays plain (button lives in the side menu), dataAttribute never changes.
|
|
35
|
+
describe('HeaderDisplayStyle — header-button icon swap', () => {
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
setActivePinia(createPinia());
|
|
38
|
+
seedNavPages(3);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const mountTiles = ({
|
|
42
|
+
displayStyle,
|
|
43
|
+
navigationDisplayType,
|
|
44
|
+
viewport = VIEWPORTS.desktop as ViewportsType,
|
|
45
|
+
isLogoVisible = true,
|
|
46
|
+
showHeaderButton = false,
|
|
47
|
+
}: {
|
|
48
|
+
displayStyle: string;
|
|
49
|
+
navigationDisplayType: string;
|
|
50
|
+
viewport?: ViewportsType;
|
|
51
|
+
isLogoVisible?: boolean;
|
|
52
|
+
showHeaderButton?: boolean;
|
|
53
|
+
}): ButtonGroupOption[] => {
|
|
54
|
+
const wrapper = shallowMount(HeaderDisplayStyle, {
|
|
55
|
+
props: {
|
|
56
|
+
displayStyle,
|
|
57
|
+
navigationDisplayType,
|
|
58
|
+
viewport,
|
|
59
|
+
isLogoVisible,
|
|
60
|
+
showHeaderButton,
|
|
61
|
+
onSelect: () => undefined,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return wrapper
|
|
66
|
+
.findComponent(ButtonGroup)
|
|
67
|
+
.props('options') as ButtonGroupOption[];
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const desktopBar = (showHeaderButton: boolean) =>
|
|
71
|
+
mountTiles({
|
|
72
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_TAB_1,
|
|
73
|
+
navigationDisplayType: NAVIGATION_DISPLAY.TAB_1,
|
|
74
|
+
showHeaderButton,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const iconNames = (options: ButtonGroupOption[]) =>
|
|
78
|
+
options.map((option) => ('iconName' in option ? option.iconName : ''));
|
|
79
|
+
|
|
80
|
+
test('off: the six desktop bar tiles keep their plain icons', () => {
|
|
81
|
+
expect(iconNames(desktopBar(false))).toEqual([
|
|
82
|
+
'header-desktop-nav-style-tab-display-style-1',
|
|
83
|
+
'header-desktop-nav-style-tab-display-style-2',
|
|
84
|
+
'header-desktop-nav-style-tab-display-style-3',
|
|
85
|
+
'header-desktop-nav-style-tab-display-style-4',
|
|
86
|
+
'header-desktop-nav-style-tab-display-style-5',
|
|
87
|
+
'header-desktop-nav-style-tab-display-style-6',
|
|
88
|
+
]);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('on: the six desktop bar tiles swap to the with-button icons', () => {
|
|
92
|
+
expect(iconNames(desktopBar(true))).toEqual([
|
|
93
|
+
'header-desktop-nav-style-tab-display-style-with-button-1',
|
|
94
|
+
'header-desktop-nav-style-tab-display-style-with-button-2',
|
|
95
|
+
'header-desktop-nav-style-tab-display-style-with-button-3',
|
|
96
|
+
'header-desktop-nav-style-tab-display-style-with-button-4',
|
|
97
|
+
'header-desktop-nav-style-tab-display-style-with-button-5',
|
|
98
|
+
'header-desktop-nav-style-tab-display-style-with-button-6',
|
|
99
|
+
]);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('value, dataAttribute and iconViewBox survive the swap', () => {
|
|
103
|
+
const off = desktopBar(false);
|
|
104
|
+
const on = desktopBar(true);
|
|
105
|
+
|
|
106
|
+
expect(on.map((option) => option.value)).toEqual(
|
|
107
|
+
off.map((option) => option.value),
|
|
108
|
+
);
|
|
109
|
+
expect(on.map((option) => option.dataAttribute)).toEqual(
|
|
110
|
+
off.map((option) => option.dataAttribute),
|
|
111
|
+
);
|
|
112
|
+
expect(
|
|
113
|
+
on.map((option) => ('iconViewBox' in option ? option.iconViewBox : '')),
|
|
114
|
+
).toEqual([
|
|
115
|
+
'0 0 160 56',
|
|
116
|
+
'0 0 160 56',
|
|
117
|
+
'0 0 160 56',
|
|
118
|
+
'0 0 160 56',
|
|
119
|
+
'0 0 160 56',
|
|
120
|
+
'0 0 160 56',
|
|
121
|
+
]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('on: the mobile bar tiles swap to the with-button icons', () => {
|
|
125
|
+
const options = mountTiles({
|
|
126
|
+
displayStyle: HEADER_DISPLAY.MOBILE_TAB_1,
|
|
127
|
+
navigationDisplayType: NAVIGATION_DISPLAY.TAB_1,
|
|
128
|
+
viewport: VIEWPORTS.mobile,
|
|
129
|
+
showHeaderButton: true,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
expect(iconNames(options)).toEqual([
|
|
133
|
+
'header-mobile-nav-style-tab-display-style-with-button-1',
|
|
134
|
+
'header-mobile-nav-style-tab-display-style-with-button-2',
|
|
135
|
+
]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('on: the desktop hamburger tiles swap to the with-button icons', () => {
|
|
139
|
+
const options = mountTiles({
|
|
140
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_HAMBURGER_1,
|
|
141
|
+
navigationDisplayType: NAVIGATION_DISPLAY.HAMBURGER_1,
|
|
142
|
+
showHeaderButton: true,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
expect(iconNames(options)).toEqual([
|
|
146
|
+
'header-desktop-nav-style-hamburger-display-style-with-button-1',
|
|
147
|
+
'header-desktop-nav-style-hamburger-display-style-with-button-2',
|
|
148
|
+
]);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Mobile hamburger has no with-button artwork on purpose: the button lives in the side menu.
|
|
152
|
+
test('the mobile hamburger tiles are left alone', () => {
|
|
153
|
+
const options = mountTiles({
|
|
154
|
+
displayStyle: HEADER_DISPLAY.MOBILE_HAMBURGER_1,
|
|
155
|
+
navigationDisplayType: NAVIGATION_DISPLAY.HAMBURGER_1,
|
|
156
|
+
viewport: 'mobile',
|
|
157
|
+
showHeaderButton: true,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
expect(
|
|
161
|
+
iconNames(options).every((name) => !name.includes('with-button')),
|
|
162
|
+
).toBe(true);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test('the desktop no-logo bar tiles are left alone', () => {
|
|
166
|
+
const options = mountTiles({
|
|
167
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_1,
|
|
168
|
+
navigationDisplayType: NAVIGATION_DISPLAY.TAB_1,
|
|
169
|
+
isLogoVisible: false,
|
|
170
|
+
showHeaderButton: true,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
expect(
|
|
174
|
+
iconNames(options).every((name) => !name.includes('with-button')),
|
|
175
|
+
).toBe(true);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('the shared display-style configs are never mutated in place', () => {
|
|
179
|
+
desktopBar(true);
|
|
180
|
+
|
|
181
|
+
// Absolute checks against the authored values, so any in-place write is caught.
|
|
182
|
+
HEADER_DISPLAY_STYLE_CONFIGS.forEach((config) => {
|
|
183
|
+
expect(config.option.isSelected).toBe(false);
|
|
184
|
+
|
|
185
|
+
if ('iconName' in config.option) {
|
|
186
|
+
expect(config.option.iconName).not.toContain('with-button');
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Desktop no-logo hamburger with the button on pins icon + button right, so the picker hides.
|
|
193
|
+
describe('HeaderDisplayStyle — hidden for no-logo hamburger with the button', () => {
|
|
194
|
+
beforeEach(() => {
|
|
195
|
+
setActivePinia(createPinia());
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const mountWrapper = ({
|
|
199
|
+
viewport = VIEWPORTS.desktop as ViewportsType,
|
|
200
|
+
isLogoVisible = false,
|
|
201
|
+
showHeaderButton = true,
|
|
202
|
+
navigationDisplayType = NAVIGATION_DISPLAY.HAMBURGER_1,
|
|
203
|
+
} = {}) =>
|
|
204
|
+
shallowMount(HeaderDisplayStyle, {
|
|
205
|
+
props: {
|
|
206
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_3,
|
|
207
|
+
navigationDisplayType,
|
|
208
|
+
viewport,
|
|
209
|
+
isLogoVisible,
|
|
210
|
+
showHeaderButton,
|
|
211
|
+
onSelect: () => undefined,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test('desktop + no logo + hamburger + button: the picker does not render', () => {
|
|
216
|
+
expect(mountWrapper().findComponent(ButtonGroup).exists()).toBe(false);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test('the picker stays with the button off', () => {
|
|
220
|
+
expect(
|
|
221
|
+
mountWrapper({ showHeaderButton: false })
|
|
222
|
+
.findComponent(ButtonGroup)
|
|
223
|
+
.exists(),
|
|
224
|
+
).toBe(true);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
test('the picker stays on mobile', () => {
|
|
228
|
+
expect(
|
|
229
|
+
mountWrapper({ viewport: VIEWPORTS.mobile as ViewportsType })
|
|
230
|
+
.findComponent(ButtonGroup)
|
|
231
|
+
.exists(),
|
|
232
|
+
).toBe(true);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Desktop no-logo bar nav with the button on and no visible pages: the nav is hidden and
|
|
237
|
+
// the button holds the right edge in every variant, so the picker hides too.
|
|
238
|
+
describe('HeaderDisplayStyle — hidden for no-logo bar nav without pages', () => {
|
|
239
|
+
beforeEach(() => {
|
|
240
|
+
setActivePinia(createPinia());
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const mountWrapper = ({
|
|
244
|
+
viewport = VIEWPORTS.desktop as ViewportsType,
|
|
245
|
+
isLogoVisible = false,
|
|
246
|
+
showHeaderButton = true,
|
|
247
|
+
} = {}) =>
|
|
248
|
+
shallowMount(HeaderDisplayStyle, {
|
|
249
|
+
props: {
|
|
250
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_1,
|
|
251
|
+
navigationDisplayType: NAVIGATION_DISPLAY.TAB_1,
|
|
252
|
+
viewport,
|
|
253
|
+
isLogoVisible,
|
|
254
|
+
showHeaderButton,
|
|
255
|
+
onSelect: () => undefined,
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test('desktop + no logo + button + only the home page: the picker does not render', () => {
|
|
260
|
+
seedNavPages(1);
|
|
261
|
+
|
|
262
|
+
expect(mountWrapper().findComponent(ButtonGroup).exists()).toBe(false);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
test('the picker stays once a second visible page exists', () => {
|
|
266
|
+
seedNavPages(2);
|
|
267
|
+
|
|
268
|
+
expect(mountWrapper().findComponent(ButtonGroup).exists()).toBe(true);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
test('a hidden second page does not count as a visible nav', () => {
|
|
272
|
+
seedNavPages(2);
|
|
273
|
+
usePageNavigationStore().routes[1].isHidden = true;
|
|
274
|
+
|
|
275
|
+
expect(mountWrapper().findComponent(ButtonGroup).exists()).toBe(false);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test('the picker stays with the button off', () => {
|
|
279
|
+
seedNavPages(1);
|
|
280
|
+
|
|
281
|
+
expect(
|
|
282
|
+
mountWrapper({ showHeaderButton: false })
|
|
283
|
+
.findComponent(ButtonGroup)
|
|
284
|
+
.exists(),
|
|
285
|
+
).toBe(true);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
test('the picker stays with a logo', () => {
|
|
289
|
+
seedNavPages(1);
|
|
290
|
+
|
|
291
|
+
expect(
|
|
292
|
+
mountWrapper({ isLogoVisible: true }).findComponent(ButtonGroup).exists(),
|
|
293
|
+
).toBe(true);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// No mobile case here: mobile bar no-logo has a single display style, so the picker
|
|
297
|
+
// never renders there regardless (the hamburger describe covers the mobile guard).
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Hiding the picker must not stop the component migrating a stored display style that no
|
|
301
|
+
// longer fits: a with-logo style left on a no-logo site collapses the header band and its
|
|
302
|
+
// pinned button hangs out of it. Building `options` is what performs that migration, so it
|
|
303
|
+
// has to be evaluated even while hidden.
|
|
304
|
+
describe('HeaderDisplayStyle — migrates an unsupported style while hidden', () => {
|
|
305
|
+
beforeEach(() => {
|
|
306
|
+
setActivePinia(createPinia());
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
const mountHidden = ({
|
|
310
|
+
displayStyle,
|
|
311
|
+
navigationDisplayType,
|
|
312
|
+
}: {
|
|
313
|
+
displayStyle: string;
|
|
314
|
+
navigationDisplayType: string;
|
|
315
|
+
}) => {
|
|
316
|
+
const selected: string[] = [];
|
|
317
|
+
const wrapper = shallowMount(HeaderDisplayStyle, {
|
|
318
|
+
props: {
|
|
319
|
+
displayStyle,
|
|
320
|
+
navigationDisplayType,
|
|
321
|
+
viewport: VIEWPORTS.desktop as ViewportsType,
|
|
322
|
+
isLogoVisible: false,
|
|
323
|
+
showHeaderButton: true,
|
|
324
|
+
onSelect: (value: string) => selected.push(value),
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
return { wrapper, selected };
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
test('bar nav without pages: the with-logo style is swapped for a no-logo one', () => {
|
|
332
|
+
seedNavPages(1);
|
|
333
|
+
|
|
334
|
+
const { wrapper, selected } = mountHidden({
|
|
335
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_TAB_5,
|
|
336
|
+
navigationDisplayType: NAVIGATION_DISPLAY.TAB_1,
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
expect(wrapper.findComponent(ButtonGroup).exists()).toBe(false);
|
|
340
|
+
expect(selected).toEqual([HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_2]);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
test('hamburger: the with-logo style is swapped for a no-logo one', () => {
|
|
344
|
+
seedNavPages(3);
|
|
345
|
+
|
|
346
|
+
const { wrapper, selected } = mountHidden({
|
|
347
|
+
displayStyle: HEADER_DISPLAY.DESKTOP_HAMBURGER_1,
|
|
348
|
+
navigationDisplayType: NAVIGATION_DISPLAY.HAMBURGER_1,
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
expect(wrapper.findComponent(ButtonGroup).exists()).toBe(false);
|
|
352
|
+
expect(selected).toEqual([HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_3]);
|
|
353
|
+
});
|
|
354
|
+
});
|
package/src/shared/page-settings/components/page-settings-section-styles/HeaderDisplayStyle.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="
|
|
2
|
+
<div v-if="isPickerVisible" class="tw-mb-2">
|
|
3
3
|
<p
|
|
4
4
|
class="tw-font-sans tw-font-bold tw-text-secondary-800 tw-text-sm tw-mb-2"
|
|
5
5
|
>
|
|
@@ -23,10 +23,12 @@ import { HEADER_DISPLAY_STYLE_CONFIGS } from '@brand-page';
|
|
|
23
23
|
import {
|
|
24
24
|
HEADER_DISPLAY,
|
|
25
25
|
NAVIGATION_DISPLAY,
|
|
26
|
+
VIEWPORTS,
|
|
26
27
|
type ViewportsType,
|
|
27
28
|
} from '@brand-page';
|
|
28
29
|
import type { ButtonGroupOption } from '@brand-page-maker/models/button-group.model';
|
|
29
30
|
import { useBrandPageMakerStore } from '@brand-page-maker/stores';
|
|
31
|
+
import { usePageNavigationStore } from '../../../page-navigation/store/page-navigation-store';
|
|
30
32
|
import { useUiPageSettingsStore } from '../../store';
|
|
31
33
|
import { tr } from '@src/composables/useTranslate';
|
|
32
34
|
|
|
@@ -36,12 +38,36 @@ interface Props {
|
|
|
36
38
|
navigationDisplayType: string;
|
|
37
39
|
isLogoVisible: boolean;
|
|
38
40
|
viewport: ViewportsType;
|
|
41
|
+
showHeaderButton?: boolean;
|
|
39
42
|
}
|
|
40
|
-
const props = defineProps<Props>()
|
|
43
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
44
|
+
showHeaderButton: false,
|
|
45
|
+
});
|
|
41
46
|
|
|
42
47
|
const brandPageMakerStore = useBrandPageMakerStore();
|
|
43
48
|
const pageSettingsStore = useUiPageSettingsStore();
|
|
44
49
|
|
|
50
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
51
|
+
|
|
52
|
+
// Desktop no-logo with the button on: nothing left to choose when the variants only
|
|
53
|
+
// differ by where they'd put things that aren't there. Hamburger — icon + button are
|
|
54
|
+
// pinned to the right regardless. Bar nav — only once the nav itself is hidden (no
|
|
55
|
+
// visible pages), where the button holds the right edge in every variant.
|
|
56
|
+
const isHidden = computed((): boolean => {
|
|
57
|
+
if (
|
|
58
|
+
!props.showHeaderButton ||
|
|
59
|
+
props.viewport !== VIEWPORTS.desktop ||
|
|
60
|
+
props.isLogoVisible
|
|
61
|
+
) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
props.navigationDisplayType.includes('hamburger') ||
|
|
67
|
+
!pageNavigationStore.hasVisibleNavigation
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
45
71
|
const options = computed(() => {
|
|
46
72
|
let filteredConfigs = HEADER_DISPLAY_STYLE_CONFIGS.filter((config) => {
|
|
47
73
|
return (
|
|
@@ -72,13 +98,16 @@ const options = computed(() => {
|
|
|
72
98
|
}
|
|
73
99
|
}
|
|
74
100
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
// Copy before setting isSelected — the config object is shared app-wide.
|
|
102
|
+
const filteredOptions: ButtonGroupOption[] = filteredConfigs.map(
|
|
103
|
+
(config) => ({
|
|
104
|
+
...config.option,
|
|
105
|
+
isSelected: props.displayStyle === config.option.value,
|
|
106
|
+
...(props.showHeaderButton && config.withButtonIconName
|
|
107
|
+
? { iconName: config.withButtonIconName }
|
|
108
|
+
: {}),
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
82
111
|
|
|
83
112
|
const selectedOption = filteredOptions.find((x) => x.isSelected);
|
|
84
113
|
|
|
@@ -176,6 +205,16 @@ const options = computed(() => {
|
|
|
176
205
|
return filteredOptions;
|
|
177
206
|
});
|
|
178
207
|
|
|
208
|
+
const isPickerVisible = computed((): boolean => {
|
|
209
|
+
// Read `options` FIRST and unconditionally: building it also migrates a stored display
|
|
210
|
+
// style that no longer fits (e.g. the logo was switched off) to its supported equivalent.
|
|
211
|
+
// Short-circuiting past it leaves the header rendering an unsupported style — a with-logo
|
|
212
|
+
// style with no logo collapses the band and its pinned button hangs out of the header.
|
|
213
|
+
const hasStylesToChooseFrom = options.value.length > 1;
|
|
214
|
+
|
|
215
|
+
return hasStylesToChooseFrom && !isHidden.value;
|
|
216
|
+
});
|
|
217
|
+
|
|
179
218
|
const numOfColumns = computed(() => {
|
|
180
219
|
if (options.value.length === 3) {
|
|
181
220
|
return 3;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { setLocaleAsync } from '@src/composables/useTranslate';
|
|
2
|
+
import { describe, test, expect, beforeEach } from 'vitest';
|
|
3
|
+
import { createPinia, setActivePinia } from 'pinia';
|
|
4
|
+
import { VIEWPORTS } from '@brand-page';
|
|
5
|
+
import type { HeaderButton } from '@brand-page';
|
|
6
|
+
import mixin from './PageSettingsSectionStyles.mixin';
|
|
7
|
+
import { useUiPageSettingsStore } from '@shared/page-settings/store';
|
|
8
|
+
|
|
9
|
+
// The button is configured once but must land on BOTH viewports; tested against a hand-built context wired to the real store.
|
|
10
|
+
const { onHeaderButtonChange } = (
|
|
11
|
+
mixin as unknown as {
|
|
12
|
+
methods: {
|
|
13
|
+
onHeaderButtonChange(this: unknown, patch: Partial<HeaderButton>): void;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
).methods;
|
|
17
|
+
|
|
18
|
+
describe('PageSettingsSectionStyles.mixin onHeaderButtonChange', () => {
|
|
19
|
+
// the seed's "Contact Us" text resolves through i18n
|
|
20
|
+
beforeAll(async () => {
|
|
21
|
+
await setLocaleAsync('en-US');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
let pageSettingsStore: ReturnType<typeof useUiPageSettingsStore>;
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
setActivePinia(createPinia());
|
|
28
|
+
pageSettingsStore = useUiPageSettingsStore();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const headers = () => pageSettingsStore.sections.header;
|
|
32
|
+
|
|
33
|
+
// The panel reads/patches the current viewport (desktop here).
|
|
34
|
+
const context = () => ({
|
|
35
|
+
pageSettingsStore,
|
|
36
|
+
headerButton: headers()[VIEWPORTS.desktop].headerButton,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const change = (patch: Partial<HeaderButton>) =>
|
|
40
|
+
onHeaderButtonChange.call(context(), patch);
|
|
41
|
+
|
|
42
|
+
test('the first write seeds a full button on both viewports', () => {
|
|
43
|
+
change({ isVisible: true });
|
|
44
|
+
|
|
45
|
+
expect(headers()[VIEWPORTS.desktop].headerButton).toEqual({
|
|
46
|
+
isVisible: true,
|
|
47
|
+
text: 'Contact Us',
|
|
48
|
+
buttonLinkType: 'url',
|
|
49
|
+
});
|
|
50
|
+
expect(headers()[VIEWPORTS.mobile].headerButton).toEqual(
|
|
51
|
+
headers()[VIEWPORTS.desktop].headerButton,
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('off by default — nothing is seeded until something is written', () => {
|
|
56
|
+
expect(headers()[VIEWPORTS.desktop].headerButton).toBeUndefined();
|
|
57
|
+
expect(headers()[VIEWPORTS.mobile].headerButton).toBeUndefined();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('later writes patch one key and still land on both viewports', () => {
|
|
61
|
+
change({ isVisible: true });
|
|
62
|
+
change({ text: 'Book now' });
|
|
63
|
+
change({ buttonLinkType: 'tel', url: '12345-6789' });
|
|
64
|
+
|
|
65
|
+
const expected: HeaderButton = {
|
|
66
|
+
isVisible: true,
|
|
67
|
+
text: 'Book now',
|
|
68
|
+
buttonLinkType: 'tel',
|
|
69
|
+
url: '12345-6789',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
expect(headers()[VIEWPORTS.desktop].headerButton).toEqual(expected);
|
|
73
|
+
expect(headers()[VIEWPORTS.mobile].headerButton).toEqual(expected);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('each viewport holds its own object, not a shared reference', () => {
|
|
77
|
+
change({ isVisible: true });
|
|
78
|
+
|
|
79
|
+
expect(headers()[VIEWPORTS.mobile].headerButton).not.toBe(
|
|
80
|
+
headers()[VIEWPORTS.desktop].headerButton,
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('a viewport that somehow diverged is reconciled by the next write', () => {
|
|
85
|
+
change({ isVisible: true, text: 'Contact' });
|
|
86
|
+
|
|
87
|
+
headers()[VIEWPORTS.mobile].headerButton = {
|
|
88
|
+
isVisible: false,
|
|
89
|
+
text: 'stale',
|
|
90
|
+
buttonLinkType: 'url',
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
change({ text: 'Contact us' });
|
|
94
|
+
|
|
95
|
+
expect(headers()[VIEWPORTS.mobile].headerButton).toEqual(
|
|
96
|
+
headers()[VIEWPORTS.desktop].headerButton,
|
|
97
|
+
);
|
|
98
|
+
expect(headers()[VIEWPORTS.mobile].headerButton?.text).toBe('Contact us');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('toggling off keeps the config, only flipping isVisible', () => {
|
|
102
|
+
change({ isVisible: true, text: 'Contact us' });
|
|
103
|
+
change({ isVisible: false });
|
|
104
|
+
|
|
105
|
+
expect(headers()[VIEWPORTS.desktop].headerButton).toEqual({
|
|
106
|
+
isVisible: false,
|
|
107
|
+
text: 'Contact us',
|
|
108
|
+
buttonLinkType: 'url',
|
|
109
|
+
});
|
|
110
|
+
expect(headers()[VIEWPORTS.mobile].headerButton).toEqual(
|
|
111
|
+
headers()[VIEWPORTS.desktop].headerButton,
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
PageSettingsFontSettingsOption,
|
|
10
10
|
} from '../../models';
|
|
11
11
|
import type {
|
|
12
|
+
HeaderButton,
|
|
12
13
|
LogoTheme,
|
|
13
14
|
NavigationDisplayType,
|
|
14
15
|
NavigationType,
|
|
@@ -27,6 +28,7 @@ import type {
|
|
|
27
28
|
BackgroundColorStyle,
|
|
28
29
|
} from '@brand-page';
|
|
29
30
|
import {
|
|
31
|
+
BUTTON_LINK_TYPE,
|
|
30
32
|
LOGO_SLIDER_DESKTOP_MAX,
|
|
31
33
|
LOGO_SLIDER_DESKTOP_MIN,
|
|
32
34
|
LOGO_SLIDER_MOBILE_MAX,
|
|
@@ -60,7 +62,14 @@ import {
|
|
|
60
62
|
} from '@shared/logo-settings/store';
|
|
61
63
|
import { FabricRenderClient } from '../../../../clients/fabric-render-client';
|
|
62
64
|
import { parseLogoThemeToCssStyles } from '@brand-page/utils';
|
|
63
|
-
import { commonTr } from '@src/composables/useTranslate';
|
|
65
|
+
import { commonTr, pageSettingsSectionTr } from '@src/composables/useTranslate';
|
|
66
|
+
|
|
67
|
+
// Starting values for a brand-new button; real "Contact Us" text so the label is never empty.
|
|
68
|
+
const newHeaderButton = (): HeaderButton => ({
|
|
69
|
+
isVisible: false,
|
|
70
|
+
text: pageSettingsSectionTr('buttonLabelPlaceholder'),
|
|
71
|
+
buttonLinkType: BUTTON_LINK_TYPE.url,
|
|
72
|
+
});
|
|
64
73
|
|
|
65
74
|
const viewportsWithTr = () => [
|
|
66
75
|
{
|
|
@@ -162,6 +171,12 @@ export default defineComponent({
|
|
|
162
171
|
header(): PageHeaderDesktop | PageHeaderMobile {
|
|
163
172
|
return this.sections[PAGE_SECTIONS.header][this.viewport];
|
|
164
173
|
},
|
|
174
|
+
headerButton(): HeaderButton | undefined {
|
|
175
|
+
return this.header.headerButton;
|
|
176
|
+
},
|
|
177
|
+
isHeaderButtonVisible(): boolean {
|
|
178
|
+
return this.headerButton?.isVisible === true;
|
|
179
|
+
},
|
|
165
180
|
navigationType(): NavigationType {
|
|
166
181
|
return getNavigationType(this.navigation.displayType);
|
|
167
182
|
},
|
|
@@ -451,6 +466,28 @@ export default defineComponent({
|
|
|
451
466
|
});
|
|
452
467
|
},
|
|
453
468
|
|
|
469
|
+
onHeaderButtonChange(patch: Partial<HeaderButton>) {
|
|
470
|
+
const value: HeaderButton = {
|
|
471
|
+
...newHeaderButton(),
|
|
472
|
+
...this.headerButton,
|
|
473
|
+
...patch,
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// Write the whole button to BOTH viewports (own copy each) so they always match.
|
|
477
|
+
this.pageSettingsStore.setPageSettingsSectionValue({
|
|
478
|
+
sectionName: PAGE_SECTIONS.header,
|
|
479
|
+
propName: 'headerButton',
|
|
480
|
+
value: { ...value },
|
|
481
|
+
viewport: VIEWPORTS.mobile,
|
|
482
|
+
});
|
|
483
|
+
this.pageSettingsStore.setPageSettingsSectionValue({
|
|
484
|
+
sectionName: PAGE_SECTIONS.header,
|
|
485
|
+
propName: 'headerButton',
|
|
486
|
+
value: { ...value },
|
|
487
|
+
viewport: VIEWPORTS.desktop,
|
|
488
|
+
});
|
|
489
|
+
},
|
|
490
|
+
|
|
454
491
|
onItemListIntentImageReplace(
|
|
455
492
|
name: PageSectionStyleOption,
|
|
456
493
|
{ index }: { index: number },
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"iconStyle": "Symbol-Stil",
|
|
9
9
|
"logoSize": "Logogröße",
|
|
10
10
|
"socialLinks": "Social-Media-Links",
|
|
11
|
-
"copyright": "Copyright"
|
|
11
|
+
"copyright": "Copyright",
|
|
12
|
+
"buttonLabel": "Etikett",
|
|
13
|
+
"buttonLabelPlaceholder": "Kontakt",
|
|
14
|
+
"buttonLink": "Link",
|
|
15
|
+
"buttonFillColor": "Füllfarbe",
|
|
16
|
+
"buttonBorderColor": "Randfarbe"
|
|
12
17
|
}
|
|
13
18
|
}
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"iconStyle": "Estilo de icono",
|
|
9
9
|
"logoSize": "Tamaño del logo",
|
|
10
10
|
"socialLinks": "Enlaces a redes sociales",
|
|
11
|
-
"copyright": "Derechos de autor"
|
|
11
|
+
"copyright": "Derechos de autor",
|
|
12
|
+
"buttonLabel": "Etiqueta",
|
|
13
|
+
"buttonLabelPlaceholder": "Contacto",
|
|
14
|
+
"buttonLink": "Enlace",
|
|
15
|
+
"buttonFillColor": "Color de relleno",
|
|
16
|
+
"buttonBorderColor": "Color del borde"
|
|
12
17
|
}
|
|
13
18
|
}
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"iconStyle": "Style d'icône",
|
|
9
9
|
"logoSize": "Taille du logo",
|
|
10
10
|
"socialLinks": "Liens vers les réseaux sociaux",
|
|
11
|
-
"copyright": "Droits d’auteur"
|
|
11
|
+
"copyright": "Droits d’auteur",
|
|
12
|
+
"buttonLabel": "Étiquette",
|
|
13
|
+
"buttonLabelPlaceholder": "Nous joindre",
|
|
14
|
+
"buttonLink": "Lien",
|
|
15
|
+
"buttonFillColor": "Couleur de remplissage",
|
|
16
|
+
"buttonBorderColor": "Couleur de bordure"
|
|
12
17
|
}
|
|
13
18
|
}
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"iconStyle": "Style d'icône",
|
|
9
9
|
"logoSize": "Taille du logo",
|
|
10
10
|
"socialLinks": "Liens vers les réseaux sociaux",
|
|
11
|
-
"copyright": "Droits d’auteur"
|
|
11
|
+
"copyright": "Droits d’auteur",
|
|
12
|
+
"buttonLabel": "Étiquette",
|
|
13
|
+
"buttonLabelPlaceholder": "Contactez-nous",
|
|
14
|
+
"buttonLink": "Lien",
|
|
15
|
+
"buttonFillColor": "Couleur de remplissage",
|
|
16
|
+
"buttonBorderColor": "Couleur de bordure"
|
|
12
17
|
}
|
|
13
18
|
}
|