@designcrowd/library.brand-page 6.1.10 → 6.1.11
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-nsMF2NQ9.js → CreatedOnBrandCrowd-de-de-DToCz9Tp.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BQI_UCR7.js → CreatedOnBrandCrowd-en-us-CrjiEGmM.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DgNOoSPn.js → CreatedOnBrandCrowd-es-es-DgVVM-Df.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-JFRaxjvx.js → CreatedOnBrandCrowd-fr-ca-C_oKH8iu.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-JFRaxjvx.js → CreatedOnBrandCrowd-fr-fr-C_oKH8iu.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DP6_-90i.js → CreatedOnBrandCrowd-pt-br-DRvHblvI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DP6_-90i.js → CreatedOnBrandCrowd-pt-pt-DRvHblvI.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-07F2wjkk.js → CreatedOnDcom-de-de-uCIRFQYA.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DaV9sa6e.js → CreatedOnDcom-en-us-DfbhIoId.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-73uOymvv.js → CreatedOnDcom-es-es-CipmOU1-.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Ci9Ome30.js → CreatedOnDcom-fr-ca-B5Cq9iJK.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DLHuMHfE.js → CreatedOnDcom-fr-fr-DIvycPcx.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-Fbt7tY-E.js → CreatedOnDcom-pt-br-BQ3EajZC.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-V2jTB6of.js → CreatedOnDcom-pt-pt-DchaL_tP.js} +1 -1
- package/lib/src/brand-page/constants/index.d.ts +1 -0
- package/lib/src/brand-page/constants/index.js +1 -0
- package/lib/src/brand-page/constants/sections/header-display.constants.d.ts +2 -1
- package/lib/src/brand-page/constants/sections/header-display.constants.js +24 -24
- package/lib/src/brand-page/constants/sections/navigation-type.constants.d.ts +9 -0
- package/lib/src/brand-page/constants/sections/navigation-type.constants.js +33 -0
- package/lib/src/brand-page/models/index.d.ts +1 -1
- package/lib/src/brand-page/models/index.js +6 -6
- package/lib/src/brand-page/utils/container-text-color.util.d.ts +7 -4
- package/lib/src/brand-page/utils/container-text-color.util.js +11 -6
- package/lib/src/brand-page/utils/migration/migration-21.js +62 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -0
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -0
- package/lib/src/brand-page-maker/models/navigation-style-configs.d.ts +1 -0
- package/lib/src/brand-page-maker/models/navigation-style-configs.js +31 -7
- package/lib/src/{bundled-translations-C98dISr1.js → bundled-translations-BiFAlQdC.js} +21 -21
- package/lib/src/{bundled-translations.de-DE-D8ul_G4P.js → bundled-translations.de-DE-DuRWnOP-.js} +14 -14
- package/lib/src/{bundled-translations.es-ES-BVmPyfw9.js → bundled-translations.es-ES-CokHdZtW.js} +17 -17
- package/lib/src/{bundled-translations.fr-CA-DmzKPhfa.js → bundled-translations.fr-CA-CJcMmubA.js} +1 -1
- package/lib/src/{bundled-translations.fr-FR-CQRiASGY.js → bundled-translations.fr-FR-DYPup8fJ.js} +1 -1
- package/lib/src/{bundled-translations.pt-BR-guDO9Yfg.js → bundled-translations.pt-BR-GSsp1kuV.js} +1 -1
- package/lib/src/{bundled-translations.pt-PT-GFpLNo-u.js → bundled-translations.pt-PT-DbkY8UQ3.js} +9 -9
- package/lib/src/bundles/bundled-translations.de-DE.json +5 -0
- package/lib/src/bundles/bundled-translations.es-ES.json +5 -0
- package/lib/src/bundles/bundled-translations.fr-CA.json +5 -0
- package/lib/src/bundles/bundled-translations.fr-FR.json +5 -0
- package/lib/src/bundles/bundled-translations.json +5 -0
- package/lib/src/bundles/bundled-translations.pt-BR.json +5 -0
- package/lib/src/bundles/bundled-translations.pt-PT.json +5 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +185 -63
- package/lib/src/css/library.brand-page-brandPage.min.css +190 -63
- package/lib/src/css/library.brand-page-designCom.min.css +185 -63
- package/lib/src/css/library.brand-page-preview.min.css +185 -63
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-D2a1EmRb.js → lib-zpGnKGKw.js} +32747 -32191
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +1 -0
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +1 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +1 -0
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +1 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +1 -0
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +4 -1
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.js +15 -1
- package/lib/src/shared/page-settings/store/page-settings-store.d.ts +6 -0
- package/lib/src/shared/page-settings/store/page-settings-store.js +22 -1
- package/package.json +2 -2
- package/src/brand-page/constants/index.ts +1 -0
- package/src/brand-page/constants/sections/header-display.constants.ts +26 -25
- package/src/brand-page/constants/sections/navigation-type.constants.test.ts +53 -0
- package/src/brand-page/constants/sections/navigation-type.constants.ts +48 -0
- package/src/brand-page/models/footer-icon-color.test.ts +38 -102
- package/src/brand-page/models/index.ts +6 -9
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +6 -6
- package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +2 -6
- package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +4 -12
- package/src/brand-page/utils/container-text-color.util.test.ts +16 -0
- package/src/brand-page/utils/container-text-color.util.ts +15 -6
- package/src/brand-page/utils/migration/migration-21.test.ts +169 -0
- package/src/brand-page/utils/migration/migration-21.ts +75 -0
- package/src/brand-page-maker/models/i18n/models.de-DE.json +3 -0
- package/src/brand-page-maker/models/i18n/models.es-ES.json +3 -0
- package/src/brand-page-maker/models/i18n/models.fr-CA.json +3 -0
- package/src/brand-page-maker/models/i18n/models.fr-FR.json +3 -0
- package/src/brand-page-maker/models/i18n/models.json +3 -0
- package/src/brand-page-maker/models/i18n/models.pt-BR.json +3 -0
- package/src/brand-page-maker/models/i18n/models.pt-PT.json +3 -0
- package/src/brand-page-maker/models/navigation-style-configs.ts +32 -6
- package/src/bundles/bundled-translations.de-DE.json +5 -0
- package/src/bundles/bundled-translations.es-ES.json +5 -0
- package/src/bundles/bundled-translations.fr-CA.json +5 -0
- package/src/bundles/bundled-translations.fr-FR.json +5 -0
- package/src/bundles/bundled-translations.json +5 -0
- package/src/bundles/bundled-translations.pt-BR.json +5 -0
- package/src/bundles/bundled-translations.pt-PT.json +5 -0
- package/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.vue +0 -6
- package/src/shared/page-settings/components/header-settings-panel/HeaderSettingsPanel.vue +8 -0
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderNavigationStyle.vue +95 -0
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderNavigationType.vue +26 -14
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.ts +33 -1
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.de-DE.json +10 -7
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.es-ES.json +10 -7
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.fr-CA.json +10 -7
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.fr-FR.json +10 -7
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.json +3 -0
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.pt-BR.json +10 -7
- package/src/shared/page-settings/components/page-settings-section-styles/i18n/page-settings-section.pt-PT.json +10 -7
- package/src/shared/page-settings/store/page-settings-store.test.ts +97 -0
- package/src/shared/page-settings/store/page-settings-store.ts +36 -1
package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts
CHANGED
|
@@ -565,6 +565,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
565
565
|
}): void;
|
|
566
566
|
collapseAllSections(): void;
|
|
567
567
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
568
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
568
569
|
}>;
|
|
569
570
|
sideBarStore: import("pinia").Store<"uiSideBar", import("../../../side-bar/store").SideBarState, {}, {
|
|
570
571
|
setBrandPageSettingsTabVisibility(payload: {
|
|
@@ -574,6 +574,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
574
574
|
}): void;
|
|
575
575
|
collapseAllSections(): void;
|
|
576
576
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
577
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
577
578
|
}>;
|
|
578
579
|
brandPageMakerStore: import("pinia").Store<"brandPageMaker", import("@brand-page-maker/stores").BrandPageMakerState, {
|
|
579
580
|
contentErrorCount(): number;
|
|
@@ -796,6 +796,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
796
796
|
}): void;
|
|
797
797
|
collapseAllSections(): void;
|
|
798
798
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
799
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
799
800
|
}>;
|
|
800
801
|
uiLogoSettingsStore: import("pinia").Store<"uiLogoSettings", import("../../../logo-settings/store").LogoSettingsState, {
|
|
801
802
|
selectedLogoImageUrl(): {
|
|
@@ -619,6 +619,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
619
619
|
}): void;
|
|
620
620
|
collapseAllSections(): void;
|
|
621
621
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
622
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
622
623
|
}>;
|
|
623
624
|
}, {
|
|
624
625
|
selectedPaymentConfig: BrandPagePaymentConfig | undefined;
|
|
@@ -786,6 +786,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
786
786
|
}): void;
|
|
787
787
|
collapseAllSections(): void;
|
|
788
788
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
789
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
789
790
|
}>;
|
|
790
791
|
}, {}, {}, {
|
|
791
792
|
onLogoUpload(response: CreateWebsiteByoUploadResult): Promise<void>;
|
|
@@ -75,6 +75,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
75
75
|
}): void;
|
|
76
76
|
collapseAllSections(): void;
|
|
77
77
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
78
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
78
79
|
}>;
|
|
79
80
|
pageNavigationStore: import("pinia").Store<"pageNavigation", import("../../../page-navigation/store/page-navigation-store").PageNavigationState, {
|
|
80
81
|
nav(): import("../../../../brand-page").NavModel;
|
|
@@ -4018,6 +4018,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
4018
4018
|
}): void;
|
|
4019
4019
|
collapseAllSections(): void;
|
|
4020
4020
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
4021
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
4021
4022
|
}>;
|
|
4022
4023
|
pageNavigationStore: import("pinia").Store<"pageNavigation", import("../../../page-navigation/store/page-navigation-store").PageNavigationState, {
|
|
4023
4024
|
nav(): import("@brand-page").NavModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
2
|
import type { PageSectionStyleOption } from '@brand-page-maker/models/page-section-style.model';
|
|
3
3
|
import type { NavigationStyleOptionValueChangeEvent, PageSection, PageSettingsFontSettingsOption } from '../../models';
|
|
4
|
-
import type { LogoTheme, NavigationDisplayType, LinksItem, HeaderDisplayStyle, FooterDisplayStyle, ViewportsType, NavigationDesktop, NavigationMobile, PageHeaderDesktop, PageHeaderMobile, PageFooterDesktop, PageFooterMobile, LogoImageModel, LogoViewModel } from '@brand-page';
|
|
4
|
+
import type { LogoTheme, NavigationDisplayType, NavigationType, LinksItem, HeaderDisplayStyle, FooterDisplayStyle, ViewportsType, NavigationDesktop, NavigationMobile, PageHeaderDesktop, PageHeaderMobile, PageFooterDesktop, PageFooterMobile, LogoImageModel, LogoViewModel } from '@brand-page';
|
|
5
5
|
import type { ContentItemFieldSettings, UpdateItemValuePayload } from '../../../content-settings/models';
|
|
6
6
|
import type { PageSettingsStateSectionStyles } from '../../store';
|
|
7
7
|
import type { DisplayLogoDraftAsset } from '../../../../clients/models';
|
|
@@ -3307,6 +3307,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3307
3307
|
}): void;
|
|
3308
3308
|
collapseAllSections(): void;
|
|
3309
3309
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
3310
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
3310
3311
|
}>;
|
|
3311
3312
|
styleSettingsStore: import("pinia").Store<"uiStyleSettings", import("../../../style-settings/store").StyleSettingsState, {
|
|
3312
3313
|
availableTextFontFamilyOptions(): import("../../../style-settings/models").StyleTextFontFamilyOption[];
|
|
@@ -4648,6 +4649,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4648
4649
|
isRenderAfterLogo(): any;
|
|
4649
4650
|
navigation(): NavigationDesktop | NavigationMobile;
|
|
4650
4651
|
header(): PageHeaderDesktop | PageHeaderMobile;
|
|
4652
|
+
navigationType(): NavigationType;
|
|
4651
4653
|
footer(): PageFooterDesktop | PageFooterMobile;
|
|
4652
4654
|
showDeviceWarning(): boolean;
|
|
4653
4655
|
showFooterDisplayStyle(): boolean;
|
|
@@ -4689,6 +4691,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4689
4691
|
findSelectedViewport(): any;
|
|
4690
4692
|
handleHeaderDisplayStyleChange(displayStyle: HeaderDisplayStyle): void;
|
|
4691
4693
|
handleHeaderNavigationDisplayTypeChange(displayType: NavigationDisplayType): void;
|
|
4694
|
+
handleHeaderNavigationTypeChange(navigationType: NavigationType): void;
|
|
4692
4695
|
handleHeaderNavigationStyleOptionValueChange({ option, value, }: NavigationStyleOptionValueChangeEvent): void;
|
|
4693
4696
|
handleFooterDisplayStyleChange(displayStyle: FooterDisplayStyle): void;
|
|
4694
4697
|
onCopyrightTextChange({ value }: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed } from 'vue';
|
|
2
2
|
import { PAGE_SECTION_STYLE_OPTIONS } from '@brand-page-maker/models/page-section-style.model';
|
|
3
3
|
import { PAGE_SECTIONS } from '../../models';
|
|
4
|
-
import { LOGO_SLIDER_DESKTOP_MAX, LOGO_SLIDER_DESKTOP_MIN, LOGO_SLIDER_MOBILE_MAX, LOGO_SLIDER_MOBILE_MIN, VIEWPORTS, } from '@brand-page';
|
|
4
|
+
import { LOGO_SLIDER_DESKTOP_MAX, LOGO_SLIDER_DESKTOP_MIN, LOGO_SLIDER_MOBILE_MAX, LOGO_SLIDER_MOBILE_MIN, VIEWPORTS, getNavigationType, NAVIGATION_TYPE_DEFAULT_DISPLAY_TYPE, } from '@brand-page';
|
|
5
5
|
import { UI_DEVICE_MODES, UI_EVENT_SOURCES } from '../../../models';
|
|
6
6
|
import { useUiPageSettingsStore } from '../../store';
|
|
7
7
|
import { useUiNavigationStyleSettingsStore } from '../../../navigation-style-settings/store';
|
|
@@ -99,6 +99,9 @@ export default defineComponent({
|
|
|
99
99
|
header() {
|
|
100
100
|
return this.sections[PAGE_SECTIONS.header][this.viewport];
|
|
101
101
|
},
|
|
102
|
+
navigationType() {
|
|
103
|
+
return getNavigationType(this.navigation.displayType);
|
|
104
|
+
},
|
|
102
105
|
footer() {
|
|
103
106
|
return this.sections[PAGE_SECTIONS.footer][this.viewport];
|
|
104
107
|
},
|
|
@@ -264,12 +267,23 @@ export default defineComponent({
|
|
|
264
267
|
});
|
|
265
268
|
},
|
|
266
269
|
handleHeaderNavigationDisplayTypeChange(displayType) {
|
|
270
|
+
this.pageSettingsStore.setPreviousSelectedNavigationDisplayType(this.viewport, displayType);
|
|
267
271
|
this.navigationStyleSettingsStore.setDisplayType({
|
|
268
272
|
section: PAGE_SECTIONS.header,
|
|
269
273
|
displayType: displayType,
|
|
270
274
|
viewport: this.viewport,
|
|
271
275
|
});
|
|
272
276
|
},
|
|
277
|
+
handleHeaderNavigationTypeChange(navigationType) {
|
|
278
|
+
if (this.navigationType === navigationType) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
// remember the outgoing style (which may be the draft's persisted value,
|
|
282
|
+
// never selected this session) so switching back restores it
|
|
283
|
+
this.pageSettingsStore.setPreviousSelectedNavigationDisplayType(this.viewport, this.navigation.displayType);
|
|
284
|
+
const remembered = this.pageSettingsStore.previousSelectedNavigationDisplayTypes?.[this.viewport]?.[navigationType];
|
|
285
|
+
this.handleHeaderNavigationDisplayTypeChange(remembered || NAVIGATION_TYPE_DEFAULT_DISPLAY_TYPE[navigationType]);
|
|
286
|
+
},
|
|
273
287
|
handleHeaderNavigationStyleOptionValueChange({ option, value, }) {
|
|
274
288
|
this.navigationStyleSettingsStore.setNavigationStyleOptionValue({
|
|
275
289
|
section: PAGE_SECTIONS.header,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ContentItem } from '../../content-settings/models';
|
|
2
2
|
import { PageHeaderDesktop, PageHeaderMobile, PageFooterDesktop, PageFooterMobile, VIEWPORTS } from '@brand-page';
|
|
3
|
+
import type { NavigationType } from '@brand-page';
|
|
3
4
|
import type { Content, ImageGalleryItem, LinksItem, LogoImageModel, ViewportsType, LogoTemplateImageModel, BrandPagePaymentConfig, BrandPagePaymentConfigCurrency } from '@brand-page';
|
|
4
5
|
import type { ContentPage } from '../models';
|
|
5
6
|
import { PAGE_SECTIONS } from '../models';
|
|
@@ -32,6 +33,10 @@ export interface PageSettingsState {
|
|
|
32
33
|
[VIEWPORTS.desktop]: string[];
|
|
33
34
|
[VIEWPORTS.mobile]: string[];
|
|
34
35
|
};
|
|
36
|
+
previousSelectedNavigationDisplayTypes?: {
|
|
37
|
+
[VIEWPORTS.desktop]: Partial<Record<NavigationType, string>>;
|
|
38
|
+
[VIEWPORTS.mobile]: Partial<Record<NavigationType, string>>;
|
|
39
|
+
};
|
|
35
40
|
}
|
|
36
41
|
export declare const useUiPageSettingsStore: import("pinia").StoreDefinition<"uiPageSettings", PageSettingsState, {
|
|
37
42
|
canAddPage(): boolean;
|
|
@@ -107,4 +112,5 @@ export declare const useUiPageSettingsStore: import("pinia").StoreDefinition<"ui
|
|
|
107
112
|
}): void;
|
|
108
113
|
collapseAllSections(): void;
|
|
109
114
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
115
|
+
setPreviousSelectedNavigationDisplayType(viewport: string, displayType: string): void;
|
|
110
116
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { PageHeaderDesktop, PageHeaderMobile, PageFooterDesktop, PageFooterMobile, VIEWPORTS, } from '@brand-page';
|
|
2
|
+
import { PageHeaderDesktop, PageHeaderMobile, PageFooterDesktop, PageFooterMobile, VIEWPORTS, getNavigationType, } from '@brand-page';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { PAGE_SECTIONS } from '../models';
|
|
5
5
|
import { navigateToPageByPageId } from '@brand-page-maker/routing';
|
|
@@ -41,6 +41,10 @@ export const useUiPageSettingsStore = defineStore('uiPageSettings', {
|
|
|
41
41
|
[VIEWPORTS.desktop]: [],
|
|
42
42
|
[VIEWPORTS.mobile]: [],
|
|
43
43
|
},
|
|
44
|
+
previousSelectedNavigationDisplayTypes: {
|
|
45
|
+
[VIEWPORTS.desktop]: {},
|
|
46
|
+
[VIEWPORTS.mobile]: {},
|
|
47
|
+
},
|
|
44
48
|
}),
|
|
45
49
|
actions: {
|
|
46
50
|
setState({ newState, }) {
|
|
@@ -244,6 +248,11 @@ export const useUiPageSettingsStore = defineStore('uiPageSettings', {
|
|
|
244
248
|
});
|
|
245
249
|
},
|
|
246
250
|
setPreviousSelectedDisplayStyle(viewport, displayStyle) {
|
|
251
|
+
// guard against a setState payload wiping the initialized default
|
|
252
|
+
this.previousSelectedDisplayStyles ??= {
|
|
253
|
+
[VIEWPORTS.desktop]: [],
|
|
254
|
+
[VIEWPORTS.mobile]: [],
|
|
255
|
+
};
|
|
247
256
|
// filter out duplicate
|
|
248
257
|
this.previousSelectedDisplayStyles[viewport] =
|
|
249
258
|
this.previousSelectedDisplayStyles[viewport].filter((x) => x !== displayStyle);
|
|
@@ -253,6 +262,18 @@ export const useUiPageSettingsStore = defineStore('uiPageSettings', {
|
|
|
253
262
|
...this.previousSelectedDisplayStyles[viewport].splice(0, 1),
|
|
254
263
|
];
|
|
255
264
|
},
|
|
265
|
+
setPreviousSelectedNavigationDisplayType(viewport, displayType) {
|
|
266
|
+
// guard against a setState payload wiping the initialized default
|
|
267
|
+
this.previousSelectedNavigationDisplayTypes ??= {
|
|
268
|
+
[VIEWPORTS.desktop]: {},
|
|
269
|
+
[VIEWPORTS.mobile]: {},
|
|
270
|
+
};
|
|
271
|
+
// one remembered style per navigation type, so switching type restores it
|
|
272
|
+
this.previousSelectedNavigationDisplayTypes[viewport] = {
|
|
273
|
+
...this.previousSelectedNavigationDisplayTypes[viewport],
|
|
274
|
+
[getNavigationType(displayType)]: displayType,
|
|
275
|
+
};
|
|
276
|
+
},
|
|
256
277
|
},
|
|
257
278
|
getters: {
|
|
258
279
|
// Single source of truth for the page-limit paywall. Admin-maker (template
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designcrowd/library.brand-page",
|
|
3
3
|
"description": "A collection of Maker/Designer applications",
|
|
4
|
-
"version": "6.1.
|
|
4
|
+
"version": "6.1.11",
|
|
5
5
|
"author": "Design.com Eng",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@ckpack/vue-color": "1.6.0",
|
|
74
|
-
"@designcrowd/fe-shared-lib": "2.0.
|
|
74
|
+
"@designcrowd/fe-shared-lib": "2.0.22",
|
|
75
75
|
"@pinia/nuxt": "0.11.3",
|
|
76
76
|
"@storybook/react": "9.0.4",
|
|
77
77
|
"@tiptap/extension-bubble-menu": "3.28.0",
|
|
@@ -5,4 +5,5 @@ export * from './misc.constants';
|
|
|
5
5
|
export * from './logo.constants';
|
|
6
6
|
export * from './sections/header-display.constants';
|
|
7
7
|
export * from './sections/navigation-display.constants';
|
|
8
|
+
export * from './sections/navigation-type.constants';
|
|
8
9
|
export * from './sections/footer-display.constants';
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '../misc.constants';
|
|
7
7
|
import type { ButtonGroupOption } from '@brand-page-maker/models/button-group.model';
|
|
8
8
|
import { NAVIGATION_DISPLAY } from './navigation-display.constants';
|
|
9
|
+
import type { NavigationType } from './navigation-type.constants';
|
|
9
10
|
|
|
10
11
|
export const HEADER_DISPLAY = {
|
|
11
12
|
/** @deprecated */
|
|
@@ -53,7 +54,7 @@ export type HeaderDisplayStyle = PageSectionDisplayStyle;
|
|
|
53
54
|
|
|
54
55
|
interface HeaderDisplayStyleConfig {
|
|
55
56
|
viewMode: 'desktop' | 'mobile';
|
|
56
|
-
navType:
|
|
57
|
+
navType: NavigationType;
|
|
57
58
|
supportLogo: boolean;
|
|
58
59
|
supportedNavTypes: string[]; // NAVIGATION_DISPLAY
|
|
59
60
|
option: ButtonGroupOption;
|
|
@@ -69,7 +70,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
69
70
|
option: {
|
|
70
71
|
value: HEADER_DISPLAY.DESKTOP_TAB_1,
|
|
71
72
|
iconName: 'header-desktop-nav-style-tab-display-style-1',
|
|
72
|
-
iconViewBox: '0 0
|
|
73
|
+
iconViewBox: '0 0 160 56',
|
|
73
74
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_1,
|
|
74
75
|
isSelected: false,
|
|
75
76
|
},
|
|
@@ -82,7 +83,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
82
83
|
option: {
|
|
83
84
|
value: HEADER_DISPLAY.DESKTOP_TAB_2,
|
|
84
85
|
iconName: 'header-desktop-nav-style-tab-display-style-2',
|
|
85
|
-
iconViewBox: '0 0
|
|
86
|
+
iconViewBox: '0 0 160 56',
|
|
86
87
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_2,
|
|
87
88
|
isSelected: false,
|
|
88
89
|
},
|
|
@@ -95,7 +96,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
95
96
|
option: {
|
|
96
97
|
value: HEADER_DISPLAY.DESKTOP_TAB_3,
|
|
97
98
|
iconName: 'header-desktop-nav-style-tab-display-style-3',
|
|
98
|
-
iconViewBox: '0 0
|
|
99
|
+
iconViewBox: '0 0 160 56',
|
|
99
100
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_3,
|
|
100
101
|
isSelected: false,
|
|
101
102
|
},
|
|
@@ -108,7 +109,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
108
109
|
option: {
|
|
109
110
|
value: HEADER_DISPLAY.DESKTOP_TAB_4,
|
|
110
111
|
iconName: 'header-desktop-nav-style-tab-display-style-4',
|
|
111
|
-
iconViewBox: '0 0
|
|
112
|
+
iconViewBox: '0 0 160 56',
|
|
112
113
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_4,
|
|
113
114
|
isSelected: false,
|
|
114
115
|
},
|
|
@@ -121,7 +122,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
121
122
|
option: {
|
|
122
123
|
value: HEADER_DISPLAY.DESKTOP_TAB_5,
|
|
123
124
|
iconName: 'header-desktop-nav-style-tab-display-style-5',
|
|
124
|
-
iconViewBox: '0 0
|
|
125
|
+
iconViewBox: '0 0 160 56',
|
|
125
126
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_5,
|
|
126
127
|
isSelected: false,
|
|
127
128
|
},
|
|
@@ -134,7 +135,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
134
135
|
option: {
|
|
135
136
|
value: HEADER_DISPLAY.DESKTOP_TAB_6,
|
|
136
137
|
iconName: 'header-desktop-nav-style-tab-display-style-6',
|
|
137
|
-
iconViewBox: '0 0
|
|
138
|
+
iconViewBox: '0 0 160 56',
|
|
138
139
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_6,
|
|
139
140
|
isSelected: false,
|
|
140
141
|
},
|
|
@@ -148,7 +149,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
148
149
|
option: {
|
|
149
150
|
value: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_1,
|
|
150
151
|
iconName: 'header-nav-style-tab-display-style-no-logo-1',
|
|
151
|
-
iconViewBox: '0 0
|
|
152
|
+
iconViewBox: '0 0 160 56',
|
|
152
153
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_1,
|
|
153
154
|
isSelected: false,
|
|
154
155
|
},
|
|
@@ -161,7 +162,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
161
162
|
option: {
|
|
162
163
|
value: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_2,
|
|
163
164
|
iconName: 'header-nav-style-tab-display-style-no-logo-2',
|
|
164
|
-
iconViewBox: '0 0
|
|
165
|
+
iconViewBox: '0 0 160 56',
|
|
165
166
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_2,
|
|
166
167
|
isSelected: false,
|
|
167
168
|
},
|
|
@@ -174,7 +175,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
174
175
|
option: {
|
|
175
176
|
value: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_3,
|
|
176
177
|
iconName: 'header-nav-style-tab-display-style-no-logo-3',
|
|
177
|
-
iconViewBox: '0 0
|
|
178
|
+
iconViewBox: '0 0 160 56',
|
|
178
179
|
dataAttribute: HEADER_DISPLAY.DESKTOP_TAB_NO_LOGO_3,
|
|
179
180
|
isSelected: false,
|
|
180
181
|
},
|
|
@@ -193,7 +194,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
193
194
|
option: {
|
|
194
195
|
value: HEADER_DISPLAY.DESKTOP_HAMBURGER_1,
|
|
195
196
|
iconName: 'header-desktop-nav-style-hamburger-display-style-1',
|
|
196
|
-
iconViewBox: '0 0
|
|
197
|
+
iconViewBox: '0 0 160 56',
|
|
197
198
|
dataAttribute: HEADER_DISPLAY.DESKTOP_HAMBURGER_1,
|
|
198
199
|
isSelected: false,
|
|
199
200
|
},
|
|
@@ -211,7 +212,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
211
212
|
option: {
|
|
212
213
|
value: HEADER_DISPLAY.DESKTOP_HAMBURGER_2,
|
|
213
214
|
iconName: 'header-desktop-nav-style-hamburger-display-style-2',
|
|
214
|
-
iconViewBox: '0 0
|
|
215
|
+
iconViewBox: '0 0 160 56',
|
|
215
216
|
dataAttribute: HEADER_DISPLAY.DESKTOP_HAMBURGER_2,
|
|
216
217
|
isSelected: false,
|
|
217
218
|
},
|
|
@@ -230,7 +231,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
230
231
|
option: {
|
|
231
232
|
value: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_1,
|
|
232
233
|
iconName: 'header-nav-style-hamburger-display-style-no-logo-1',
|
|
233
|
-
iconViewBox: '0 0
|
|
234
|
+
iconViewBox: '0 0 160 56',
|
|
234
235
|
dataAttribute: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_1,
|
|
235
236
|
isSelected: false,
|
|
236
237
|
},
|
|
@@ -248,7 +249,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
248
249
|
option: {
|
|
249
250
|
value: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_2,
|
|
250
251
|
iconName: 'header-nav-style-hamburger-display-style-no-logo-2',
|
|
251
|
-
iconViewBox: '0 0
|
|
252
|
+
iconViewBox: '0 0 160 56',
|
|
252
253
|
dataAttribute: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_2,
|
|
253
254
|
isSelected: false,
|
|
254
255
|
},
|
|
@@ -266,7 +267,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
266
267
|
option: {
|
|
267
268
|
value: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_3,
|
|
268
269
|
iconName: 'header-nav-style-hamburger-display-style-no-logo-3',
|
|
269
|
-
iconViewBox: '0 0
|
|
270
|
+
iconViewBox: '0 0 160 56',
|
|
270
271
|
dataAttribute: HEADER_DISPLAY.DESKTOP_HAMBURGER_NO_LOGO_3,
|
|
271
272
|
isSelected: false,
|
|
272
273
|
},
|
|
@@ -280,7 +281,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
280
281
|
option: {
|
|
281
282
|
value: HEADER_DISPLAY.MOBILE_TAB_1,
|
|
282
283
|
iconName: 'header-mobile-nav-style-tab-display-style-1',
|
|
283
|
-
iconViewBox: '0 0
|
|
284
|
+
iconViewBox: '0 0 160 56',
|
|
284
285
|
dataAttribute: HEADER_DISPLAY.MOBILE_TAB_1,
|
|
285
286
|
isSelected: false,
|
|
286
287
|
},
|
|
@@ -293,7 +294,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
293
294
|
option: {
|
|
294
295
|
value: HEADER_DISPLAY.MOBILE_TAB_2,
|
|
295
296
|
iconName: 'header-mobile-nav-style-tab-display-style-2',
|
|
296
|
-
iconViewBox: '0 0
|
|
297
|
+
iconViewBox: '0 0 160 56',
|
|
297
298
|
dataAttribute: HEADER_DISPLAY.MOBILE_TAB_2,
|
|
298
299
|
isSelected: false,
|
|
299
300
|
},
|
|
@@ -307,7 +308,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
307
308
|
option: {
|
|
308
309
|
value: HEADER_DISPLAY.MOBILE_TAB_NO_LOGO_1,
|
|
309
310
|
iconName: 'header-nav-style-tab-display-style-no-logo-2',
|
|
310
|
-
iconViewBox: '0 0
|
|
311
|
+
iconViewBox: '0 0 160 56',
|
|
311
312
|
dataAttribute: HEADER_DISPLAY.MOBILE_TAB_NO_LOGO_1,
|
|
312
313
|
isSelected: false,
|
|
313
314
|
},
|
|
@@ -326,7 +327,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
326
327
|
option: {
|
|
327
328
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_1,
|
|
328
329
|
iconName: 'header-mobile-nav-style-hamburger-display-style-1',
|
|
329
|
-
iconViewBox: '0 0
|
|
330
|
+
iconViewBox: '0 0 160 56',
|
|
330
331
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_1,
|
|
331
332
|
isSelected: false,
|
|
332
333
|
},
|
|
@@ -344,7 +345,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
344
345
|
option: {
|
|
345
346
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_2,
|
|
346
347
|
iconName: 'header-mobile-nav-style-hamburger-display-style-2',
|
|
347
|
-
iconViewBox: '0 0
|
|
348
|
+
iconViewBox: '0 0 160 56',
|
|
348
349
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_2,
|
|
349
350
|
isSelected: false,
|
|
350
351
|
},
|
|
@@ -362,7 +363,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
362
363
|
option: {
|
|
363
364
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_3,
|
|
364
365
|
iconName: 'header-mobile-nav-style-hamburger-display-style-3',
|
|
365
|
-
iconViewBox: '0 0
|
|
366
|
+
iconViewBox: '0 0 160 56',
|
|
366
367
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_3,
|
|
367
368
|
isSelected: false,
|
|
368
369
|
},
|
|
@@ -380,7 +381,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
380
381
|
option: {
|
|
381
382
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_4,
|
|
382
383
|
iconName: 'header-mobile-nav-style-hamburger-display-style-4',
|
|
383
|
-
iconViewBox: '0 0
|
|
384
|
+
iconViewBox: '0 0 160 56',
|
|
384
385
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_4,
|
|
385
386
|
isSelected: false,
|
|
386
387
|
},
|
|
@@ -399,7 +400,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
399
400
|
option: {
|
|
400
401
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_NO_LOGO_1,
|
|
401
402
|
iconName: 'header-nav-style-hamburger-display-style-no-logo-1',
|
|
402
|
-
iconViewBox: '0 0
|
|
403
|
+
iconViewBox: '0 0 160 56',
|
|
403
404
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_NO_LOGO_1,
|
|
404
405
|
isSelected: false,
|
|
405
406
|
},
|
|
@@ -417,7 +418,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
417
418
|
option: {
|
|
418
419
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_NO_LOGO_2,
|
|
419
420
|
iconName: 'header-nav-style-hamburger-display-style-no-logo-2',
|
|
420
|
-
iconViewBox: '0 0
|
|
421
|
+
iconViewBox: '0 0 160 56',
|
|
421
422
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_NO_LOGO_2,
|
|
422
423
|
isSelected: false,
|
|
423
424
|
},
|
|
@@ -435,7 +436,7 @@ export const HEADER_DISPLAY_STYLE_CONFIGS: HeaderDisplayStyleConfig[] = [
|
|
|
435
436
|
option: {
|
|
436
437
|
value: HEADER_DISPLAY.MOBILE_HAMBURGER_NO_LOGO_3,
|
|
437
438
|
iconName: 'header-nav-style-hamburger-display-style-no-logo-3',
|
|
438
|
-
iconViewBox: '0 0
|
|
439
|
+
iconViewBox: '0 0 160 56',
|
|
439
440
|
dataAttribute: HEADER_DISPLAY.MOBILE_HAMBURGER_NO_LOGO_3,
|
|
440
441
|
isSelected: false,
|
|
441
442
|
},
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NAVIGATION_DISPLAY } from './navigation-display.constants';
|
|
2
|
+
import {
|
|
3
|
+
NAVIGATION_TYPE,
|
|
4
|
+
NAVIGATION_TYPE_DEFAULT_DISPLAY_TYPE,
|
|
5
|
+
getNavigationType,
|
|
6
|
+
} from './navigation-type.constants';
|
|
7
|
+
|
|
8
|
+
describe('getNavigationType', () => {
|
|
9
|
+
test.each([
|
|
10
|
+
[NAVIGATION_DISPLAY.TAB_1, NAVIGATION_TYPE.bar],
|
|
11
|
+
[NAVIGATION_DISPLAY.TAB_2, NAVIGATION_TYPE.bar],
|
|
12
|
+
[NAVIGATION_DISPLAY.HAMBURGER_1, NAVIGATION_TYPE.hamburger],
|
|
13
|
+
[NAVIGATION_DISPLAY.HAMBURGER_2, NAVIGATION_TYPE.hamburger],
|
|
14
|
+
[NAVIGATION_DISPLAY.HAMBURGER_3, NAVIGATION_TYPE.hamburger],
|
|
15
|
+
[NAVIGATION_DISPLAY.HAMBURGER_4, NAVIGATION_TYPE.hamburger],
|
|
16
|
+
])('classifies modern display type %s as %s', (displayType, expected) => {
|
|
17
|
+
expect(getNavigationType(displayType)).toEqual(expected);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test.each([
|
|
21
|
+
[NAVIGATION_DISPLAY.tabs, NAVIGATION_TYPE.bar],
|
|
22
|
+
[NAVIGATION_DISPLAY.buttons, NAVIGATION_TYPE.bar],
|
|
23
|
+
[NAVIGATION_DISPLAY.hamburger, NAVIGATION_TYPE.hamburger],
|
|
24
|
+
[NAVIGATION_DISPLAY.hamburgerLight, NAVIGATION_TYPE.hamburger],
|
|
25
|
+
[NAVIGATION_DISPLAY.hamburgerLightHalf, NAVIGATION_TYPE.hamburger],
|
|
26
|
+
[NAVIGATION_DISPLAY.hamburgerRounded, NAVIGATION_TYPE.hamburger],
|
|
27
|
+
])(
|
|
28
|
+
'classifies deprecated legacy display type %s as %s (backward compat)',
|
|
29
|
+
(displayType, expected) => {
|
|
30
|
+
expect(getNavigationType(displayType)).toEqual(expected);
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
test('falls back to substring classification for unknown persisted values', () => {
|
|
35
|
+
expect(getNavigationType('some-future-hamburger-style')).toEqual(
|
|
36
|
+
NAVIGATION_TYPE.hamburger,
|
|
37
|
+
);
|
|
38
|
+
expect(getNavigationType('some-future-tab-style')).toEqual(
|
|
39
|
+
NAVIGATION_TYPE.bar,
|
|
40
|
+
);
|
|
41
|
+
expect(getNavigationType('')).toEqual(NAVIGATION_TYPE.bar);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('NAVIGATION_TYPE_DEFAULT_DISPLAY_TYPE', () => {
|
|
46
|
+
test('each navigation type defaults to a display type of its own group', () => {
|
|
47
|
+
Object.entries(NAVIGATION_TYPE_DEFAULT_DISPLAY_TYPE).forEach(
|
|
48
|
+
([navigationType, displayType]) => {
|
|
49
|
+
expect(getNavigationType(displayType)).toEqual(navigationType);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NAVIGATION_DISPLAY } from './navigation-display.constants';
|
|
2
|
+
import type { NavigationDisplayType } from './navigation-display.constants';
|
|
3
|
+
|
|
4
|
+
export const NAVIGATION_TYPE = {
|
|
5
|
+
// 'tabs' matches the legacy persisted HEADER_DISPLAY_STYLE_CONFIGS.navType
|
|
6
|
+
// value — the key/value mismatch is load-bearing for backward compat.
|
|
7
|
+
bar: 'tabs',
|
|
8
|
+
hamburger: 'hamburger',
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export type NavigationType =
|
|
12
|
+
(typeof NAVIGATION_TYPE)[keyof typeof NAVIGATION_TYPE];
|
|
13
|
+
|
|
14
|
+
// Exhaustive: TS forces every NAVIGATION_DISPLAY value (current + deprecated legacy) to be classified
|
|
15
|
+
// into a group here, so a future style can't be added without deciding which group it belongs to.
|
|
16
|
+
export const NAVIGATION_TYPE_BY_DISPLAY_TYPE: Record<
|
|
17
|
+
NavigationDisplayType,
|
|
18
|
+
NavigationType
|
|
19
|
+
> = {
|
|
20
|
+
[NAVIGATION_DISPLAY.TAB_1]: NAVIGATION_TYPE.bar,
|
|
21
|
+
[NAVIGATION_DISPLAY.TAB_2]: NAVIGATION_TYPE.bar,
|
|
22
|
+
[NAVIGATION_DISPLAY.HAMBURGER_1]: NAVIGATION_TYPE.hamburger,
|
|
23
|
+
[NAVIGATION_DISPLAY.HAMBURGER_2]: NAVIGATION_TYPE.hamburger,
|
|
24
|
+
[NAVIGATION_DISPLAY.HAMBURGER_3]: NAVIGATION_TYPE.hamburger,
|
|
25
|
+
[NAVIGATION_DISPLAY.HAMBURGER_4]: NAVIGATION_TYPE.hamburger,
|
|
26
|
+
[NAVIGATION_DISPLAY.tabs]: NAVIGATION_TYPE.bar,
|
|
27
|
+
[NAVIGATION_DISPLAY.buttons]: NAVIGATION_TYPE.bar,
|
|
28
|
+
[NAVIGATION_DISPLAY.hamburger]: NAVIGATION_TYPE.hamburger,
|
|
29
|
+
[NAVIGATION_DISPLAY.hamburgerLight]: NAVIGATION_TYPE.hamburger,
|
|
30
|
+
[NAVIGATION_DISPLAY.hamburgerLightHalf]: NAVIGATION_TYPE.hamburger,
|
|
31
|
+
[NAVIGATION_DISPLAY.hamburgerRounded]: NAVIGATION_TYPE.hamburger,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const NAVIGATION_TYPE_DEFAULT_DISPLAY_TYPE: Record<
|
|
35
|
+
NavigationType,
|
|
36
|
+
NavigationDisplayType
|
|
37
|
+
> = {
|
|
38
|
+
[NAVIGATION_TYPE.bar]: NAVIGATION_DISPLAY.TAB_1,
|
|
39
|
+
[NAVIGATION_TYPE.hamburger]: NAVIGATION_DISPLAY.HAMBURGER_1,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Falls back to a substring sniff for any value not in the map (e.g. a hand-edited
|
|
43
|
+
// or not-yet-migrated draft) so this can never fail to classify a stored displayType.
|
|
44
|
+
export const getNavigationType = (displayType: string): NavigationType =>
|
|
45
|
+
NAVIGATION_TYPE_BY_DISPLAY_TYPE[displayType as NavigationDisplayType] ??
|
|
46
|
+
(displayType.includes('hamburger')
|
|
47
|
+
? NAVIGATION_TYPE.hamburger
|
|
48
|
+
: NAVIGATION_TYPE.bar);
|