@sok-brand-sites/common-frontend-components 0.0.1-security → 1.643.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @sok-brand-sites/common-frontend-components might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +31 -3
- package/dist/_virtual/_tslib.js +234 -0
- package/dist/assets/icons/Icons.js +118 -0
- package/dist/assets/logos/logos.js +19 -0
- package/dist/components/Accordion/Accordion.js +36 -0
- package/dist/components/Accordion/Accordion.styles.js +75 -0
- package/dist/components/AnimationWrapper/AnimationWrapper.js +35 -0
- package/dist/components/AnimationWrapper/AnimationWrapper.styles.js +26 -0
- package/dist/components/BlockGenerator/BlockContent.js +139 -0
- package/dist/components/BlockGenerator/BlockGenerator.js +62 -0
- package/dist/components/BlockGenerator/BlockGenerator.styles.js +44 -0
- package/dist/components/Button/Button.js +49 -0
- package/dist/components/Button/Button.styles.js +46 -0
- package/dist/components/Card/Card.js +79 -0
- package/dist/components/Card/Card.styles.js +137 -0
- package/dist/components/Carousel/Carousel.js +153 -0
- package/dist/components/Carousel/Carousel.styles.js +261 -0
- package/dist/components/CarouselNarrow/CarouselNarrow.js +120 -0
- package/dist/components/CarouselNarrow/CarouselNarrow.styles.js +281 -0
- package/dist/components/Column/Column.js +31 -0
- package/dist/components/Column/Column.styles.js +34 -0
- package/dist/components/Columns/Columns.js +38 -0
- package/dist/components/Columns/Columns.styles.js +21 -0
- package/dist/components/Embed/Embed.js +54 -0
- package/dist/components/Embed/Embed.styles.js +12 -0
- package/dist/components/Footer/Footer.js +63 -0
- package/dist/components/Footer/Footer.styles.js +67 -0
- package/dist/components/FormBuilder/FormBuilder.js +364 -0
- package/dist/components/FormBuilder/FormBuilder.styles.js +224 -0
- package/dist/components/FormBuilder/FormBuilderCheckboxes.js +39 -0
- package/dist/components/FormBuilder/FormBuilderInput.js +29 -0
- package/dist/components/FormBuilder/FormBuilderParagraph.js +15 -0
- package/dist/components/FormBuilder/FormBuilderSelect.js +39 -0
- package/dist/components/FormBuilder/FormBuilderTextAreaInput.js +29 -0
- package/dist/components/FormBuilder/utiles.js +13 -0
- package/dist/components/FullBgHero/FullBgHero.js +93 -0
- package/dist/components/FullBgHero/FullBgHero.styles.js +180 -0
- package/dist/components/GlobalStyle/GlobalStyle.js +285 -0
- package/dist/components/Header/Header.js +290 -0
- package/dist/components/Header/Header.styles.js +314 -0
- package/dist/components/Heading/Heading.js +29 -0
- package/dist/components/Heading/Heading.styles.js +21 -0
- package/dist/components/Hero/Hero.js +76 -0
- package/dist/components/Hero/Hero.styles.js +128 -0
- package/dist/components/IconLinks/IconLinks.js +118 -0
- package/dist/components/IconLinks/IconLinks.styles.js +259 -0
- package/dist/components/ImageCarousel/ImageCarousel.js +102 -0
- package/dist/components/ImageCarousel/ImageCarousel.styles.js +96 -0
- package/dist/components/LanguageSelector/LanguageSelector.js +72 -0
- package/dist/components/LanguageSelector/LanguageSelector.styles.js +72 -0
- package/dist/components/Layout/Layout.js +15 -0
- package/dist/components/Layout/Layout.styles.js +8 -0
- package/dist/components/List/List.js +25 -0
- package/dist/components/List/List.styles.js +11 -0
- package/dist/components/MarginWrapper/MarginWrapper.js +17 -0
- package/dist/components/MarginWrapper/MarginWrapper.styles.js +38 -0
- package/dist/components/OverlayCards/OverlayCard/OverlayCard.js +132 -0
- package/dist/components/OverlayCards/OverlayCard/OverlayCard.styles.js +133 -0
- package/dist/components/OverlayCards/OverlayCards.js +46 -0
- package/dist/components/OverlayCards/OverlayCards.styles.js +14 -0
- package/dist/components/OverlayCards/OverlayCards.types.js +9 -0
- package/dist/components/Paragraph/Paragraph.js +29 -0
- package/dist/components/Paragraph/Paragraph.styles.js +14 -0
- package/dist/components/PlaceOfBusiness/ContactInformation/ContactInformation.js +45 -0
- package/dist/components/PlaceOfBusiness/ContactInformation/ContactInformation.styles.js +37 -0
- package/dist/components/PlaceOfBusiness/LogoTitle/LogoTitle.js +16 -0
- package/dist/components/PlaceOfBusiness/LogoTitle/LogoTitle.styles.js +44 -0
- package/dist/components/PlaceOfBusiness/OpenToday/OpenToday.js +43 -0
- package/dist/components/PlaceOfBusiness/OpenToday/OpenToday.styles.js +63 -0
- package/dist/components/PlaceOfBusiness/OpeningHours/OpeningHours.js +77 -0
- package/dist/components/PlaceOfBusiness/OpeningHours/OpeningHours.styles.js +68 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessInfo/PlaceOfBusinessInfo.js +125 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessInfo/PlaceOfBusinessInfo.styles.js +32 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessListItem/PlaceOfBusinessListItem.js +85 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessListItem/PlaceOfBusinessListItem.styles.js +134 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessSearch/PlaceOfBusinessSearch.js +142 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessSearch/PlaceOfBusinessSearch.styles.js +43 -0
- package/dist/components/PlaceOfBusiness/Services/Services.js +30 -0
- package/dist/components/PlaceOfBusiness/Services/Services.styles.js +61 -0
- package/dist/components/PlaceOfBusiness/utils.js +177 -0
- package/dist/components/Promotion/Promotion.js +66 -0
- package/dist/components/Promotion/Promotion.styles.js +124 -0
- package/dist/components/RestrictedWidthContainer/RestrictedWidthContainer.js +63 -0
- package/dist/components/Seo/Seo.js +58 -0
- package/dist/components/SideBySide/SideBySide.js +81 -0
- package/dist/components/SideBySide/SideBySide.styles.js +179 -0
- package/dist/components/SocialMediaLinks/SocialMediaLinks.js +28 -0
- package/dist/components/SocialMediaLinks/SocialMediaLinks.styles.js +22 -0
- package/dist/components/SubHero/SubHero.js +22 -0
- package/dist/components/SubHero/SubHero.styles.js +52 -0
- package/dist/components/Table/Table.js +23 -0
- package/dist/components/Table/Table.styles.js +121 -0
- package/dist/components/Table/WpTable.styles.js +5 -0
- package/dist/components/constants.js +34 -0
- package/dist/components/utils.js +160 -0
- package/dist/fonts/Agrandir/Agrandir-Bold.woff.js +2 -0
- package/dist/fonts/Agrandir/Agrandir-Bold.woff2.js +2 -0
- package/dist/fonts/Agrandir/Agrandir-Light.woff.js +2 -0
- package/dist/fonts/Agrandir/Agrandir-Light.woff2.js +2 -0
- package/dist/fonts/Agrandir/index.js +16 -0
- package/dist/fonts/Brule/Brule-Bold.woff.js +2 -0
- package/dist/fonts/Brule/Brule-Bold.woff2.js +2 -0
- package/dist/fonts/Brule/Brule-Medium.woff.js +2 -0
- package/dist/fonts/Brule/Brule-Medium.woff2.js +2 -0
- package/dist/fonts/Brule/Brule-Regular.woff.js +2 -0
- package/dist/fonts/Brule/Brule-Regular.woff2.js +2 -0
- package/dist/fonts/Brule/index.js +18 -0
- package/dist/fonts/Domaine/Domaine-Text-Medium.woff.js +2 -0
- package/dist/fonts/Domaine/Domaine-Text-Medium.woff2.js +2 -0
- package/dist/fonts/Domaine/index.js +14 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-Bk.woff.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-Bk.woff2.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-DmCn.woff.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-DmCn.woff2.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-MdCn.woff.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-MdCn.woff2.js +2 -0
- package/dist/fonts/FranklinGothic/index.js +18 -0
- package/dist/fonts/MinionPro/MinionPro-Regular.woff.js +2 -0
- package/dist/fonts/MinionPro/MinionPro-Regular.woff2.js +2 -0
- package/dist/fonts/MinionPro/index.js +14 -0
- package/dist/fonts/Montserrat/Montserrat-Bold.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Bold.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-BoldItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-BoldItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBold.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBold.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBoldItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBoldItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Italic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Italic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Light.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Light.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-LightItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-LightItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Medium.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Medium.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-MediumItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-MediumItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Regular.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Regular.woff2.js +2 -0
- package/dist/fonts/Montserrat/index.js +90 -0
- package/dist/fonts/SBonus/SBonusUX-BoldItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-BoldItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-ExtraboldItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-ExtraboldItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-LightItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-LightItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-MediumItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-MediumItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-RegularItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-RegularItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Bold.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Bold.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Extrabold.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Extrabold.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Light.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Light.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Medium.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Medium.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Regular.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Regular.woff2.js +2 -0
- package/dist/fonts/SBonus/index.js +95 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Bold.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Bold.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Light.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Light.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Medium.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Medium.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Regular.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Regular.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-SemiBold.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-SemiBold.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/index.js +22 -0
- package/dist/fonts/SuomiGrumpy/SuomiGrumpy-Black.woff.js +2 -0
- package/dist/fonts/SuomiGrumpy/SuomiGrumpy-Black.woff2.js +2 -0
- package/dist/fonts/SuomiGrumpy/index.js +14 -0
- package/dist/fonts/utils.js +5 -0
- package/dist/hooks/useElementRect.js +65 -0
- package/dist/hooks/windowsize.js +31 -0
- package/dist/locales/constants.js +6 -0
- package/dist/locales/translations.json.js +153 -0
- package/dist/styles/media.js +40 -0
- package/dist/themes/neutral/breakpoints.js +11 -0
- package/dist/themes/neutral/colors.js +3 -0
- package/dist/themes/neutral/components.js +940 -0
- package/dist/themes/neutral/fonts.js +7 -0
- package/dist/themes/neutral/index.js +10 -0
- package/dist/themes/neutral/spacings.js +21 -0
- package/dist/themes/ravintolakonseptit/breakpoints.js +11 -0
- package/dist/themes/ravintolakonseptit/colors.js +17 -0
- package/dist/themes/ravintolakonseptit/components.js +936 -0
- package/dist/themes/ravintolakonseptit/fonts.js +5 -0
- package/dist/themes/ravintolakonseptit/index.js +10 -0
- package/dist/themes/ravintolakonseptit/spacings.js +21 -0
- package/dist/themes/sokos/breakpoints.js +11 -0
- package/dist/themes/sokos/colors.js +3 -0
- package/dist/themes/sokos/components.js +936 -0
- package/dist/themes/sokos/index.js +10 -0
- package/dist/themes/sokospalvelut/breakpoints.js +11 -0
- package/dist/themes/sokospalvelut/colors.js +3 -0
- package/dist/themes/sokospalvelut/components.js +936 -0
- package/dist/themes/sokospalvelut/fonts.js +11 -0
- package/dist/themes/sokospalvelut/index.js +10 -0
- package/dist/themes/theme.types.js +12 -0
- package/dist/themes/tykkimakiresort/colors.js +35 -0
- package/dist/themes/tykkimakiresort/components.js +936 -0
- package/dist/themes/tykkimakiresort/fonts.js +7 -0
- package/dist/themes/tykkimakiresort/index.js +10 -0
- package/package.json +33 -3
- package/scripts/build.js +132 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
import { __read, __assign } from '../../_virtual/_tslib.js';
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
3
|
+
import React, { forwardRef, useState, useEffect } from 'react';
|
4
|
+
import { HeaderContainer, FlexContainer, MainContainer, LogoContainer, Logo, LogoContainerLink, PrimaryContainer, FirstLevelLinksContainer, FirstLevelLink, SecondaryContainer, HamburgerButton, HamburgerAnimation, HeaderBottomBar, SecondLevelLinksContainer, SecondLevelLink, MobileNavigation, MobileLinksContainer, FirstLevelLinkButton, ArrowButton, CollapsingMobileLinksContainer, SecondLevelLinkButton } from './Header.styles.js';
|
5
|
+
import LanguageSelector from '../LanguageSelector/LanguageSelector.js';
|
6
|
+
import { ArrowDown } from '../../assets/icons/Icons.js';
|
7
|
+
import { SLogo } from '../../assets/logos/logos.js';
|
8
|
+
import { locales } from '../../locales/constants.js';
|
9
|
+
import { useWindowSize } from '../../hooks/windowsize.js';
|
10
|
+
import { getTheme, isExternalURL, getCurrentThemeName } from '../utils.js';
|
11
|
+
/**
|
12
|
+
* @param links links and their sublinks for the Header
|
13
|
+
* @param translations translations and paths for the differnt language versions of the page
|
14
|
+
* @param logo a React node to render instead of the default logo
|
15
|
+
* @param logoUrl logo image url
|
16
|
+
* @param disableLogoLink should be true, if the logo should not be a link directing to the site's root url
|
17
|
+
* @param children children will be rendered to the right side of the desktop header and to
|
18
|
+
* the bottom of the mobile header
|
19
|
+
*
|
20
|
+
* Logo use cases:
|
21
|
+
*
|
22
|
+
* Logo directs to site's root url
|
23
|
+
* * provide either prop logoUrl or logo (\<svg\> or \<img\>)
|
24
|
+
* * prop disableLogoLink should be false
|
25
|
+
*
|
26
|
+
* Logo is not a link
|
27
|
+
* * provide either prop logoUrl or logo (\<svg\> or \<img\>)
|
28
|
+
* * prop disableLogoLink should be true
|
29
|
+
*
|
30
|
+
* Logo directs to another url than the site's root url
|
31
|
+
* * provide prop logo (\<a\>)
|
32
|
+
* * prop disableLogoLink should be true
|
33
|
+
* */
|
34
|
+
|
35
|
+
var Header = forwardRef(function (_a, ref) {
|
36
|
+
var _b, _c;
|
37
|
+
|
38
|
+
var links = _a.links,
|
39
|
+
translations = _a.translations,
|
40
|
+
logo = _a.logo,
|
41
|
+
logoUrl = _a.logoUrl,
|
42
|
+
children = _a.children,
|
43
|
+
disableLogoLink = _a.disableLogoLink,
|
44
|
+
_d = _a.forcedFakeCurrentUrl,
|
45
|
+
forcedFakeCurrentUrl = _d === void 0 ? '' : _d;
|
46
|
+
|
47
|
+
var _e = __read(useState(false), 2),
|
48
|
+
showHeaderContent = _e[0],
|
49
|
+
setShowHeaderContent = _e[1];
|
50
|
+
|
51
|
+
var windowSize = useWindowSize();
|
52
|
+
var theme = getTheme(getCurrentThemeName());
|
53
|
+
|
54
|
+
var _f = __read(useState(false), 2),
|
55
|
+
mobileMenuOpen = _f[0],
|
56
|
+
setMobileMenuOpen = _f[1];
|
57
|
+
|
58
|
+
var _g = __read(useState(windowSize.width < parseFloat(theme.breakpoints.tablet)), 2),
|
59
|
+
mobile = _g[0],
|
60
|
+
setMobile = _g[1];
|
61
|
+
|
62
|
+
var _h = __read(useState(), 2),
|
63
|
+
activeFirstLevelLink = _h[0],
|
64
|
+
setActiveFirstLevelLink = _h[1];
|
65
|
+
|
66
|
+
var _j = __read(useState(), 2),
|
67
|
+
activeSecondLevelLink = _j[0],
|
68
|
+
setActiveSecondLevelLink = _j[1];
|
69
|
+
|
70
|
+
var _k = __read(useState(), 2),
|
71
|
+
expandedMobileNavigationLink = _k[0],
|
72
|
+
setExpandedMobileNavigationLink = _k[1];
|
73
|
+
|
74
|
+
var hasLinks = links && links.length > 0;
|
75
|
+
|
76
|
+
var handleHamburgerClick = function handleHamburgerClick() {
|
77
|
+
if (mobileMenuOpen) {
|
78
|
+
setMobileMenuOpen(false);
|
79
|
+
} else {
|
80
|
+
setExpandedMobileNavigationLink(activeFirstLevelLink);
|
81
|
+
setMobileMenuOpen(true);
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
var handleMobileNavigationExpand = function handleMobileNavigationExpand(link) {
|
86
|
+
if ((link === null || link === void 0 ? void 0 : link.path) === (expandedMobileNavigationLink === null || expandedMobileNavigationLink === void 0 ? void 0 : expandedMobileNavigationLink.path)) {
|
87
|
+
setExpandedMobileNavigationLink(undefined);
|
88
|
+
} else {
|
89
|
+
setExpandedMobileNavigationLink(link);
|
90
|
+
}
|
91
|
+
};
|
92
|
+
|
93
|
+
var getRootUrl = function getRootUrl() {
|
94
|
+
if ((translations === null || translations === void 0 ? void 0 : translations.currentLanguage) && translations.currentLanguage !== locales.FI) {
|
95
|
+
return "/" + translations.currentLanguage.toLowerCase();
|
96
|
+
}
|
97
|
+
|
98
|
+
return '/';
|
99
|
+
};
|
100
|
+
|
101
|
+
var hasChildLinks = function hasChildLinks(link) {
|
102
|
+
var _a, _b;
|
103
|
+
|
104
|
+
return !!((_b = (_a = link === null || link === void 0 ? void 0 : link.childItems) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.length);
|
105
|
+
};
|
106
|
+
|
107
|
+
var hasMultipleTranslations = function hasMultipleTranslations() {
|
108
|
+
return (translations === null || translations === void 0 ? void 0 : translations.paths) && Object.values(translations === null || translations === void 0 ? void 0 : translations.paths).length > 1;
|
109
|
+
};
|
110
|
+
|
111
|
+
var hasContent = hasLinks || hasMultipleTranslations() || children;
|
112
|
+
useEffect(function () {
|
113
|
+
if (windowSize.width >= parseFloat(theme.breakpoints.tablet)) {
|
114
|
+
setMobile(false);
|
115
|
+
} else setMobile(true);
|
116
|
+
}, [windowSize]);
|
117
|
+
useEffect(function () {
|
118
|
+
var _a;
|
119
|
+
/*
|
120
|
+
url is defined conditionally due to Storybook.
|
121
|
+
If Header is rendered in Storybook using iframe,
|
122
|
+
url should be document.referrer instead of document.location.href
|
123
|
+
*/
|
124
|
+
|
125
|
+
|
126
|
+
var url = window.location !== window.parent.location ? document.referrer : document.location.href;
|
127
|
+
/*
|
128
|
+
To open the second level navigation by default in docs page
|
129
|
+
*/
|
130
|
+
|
131
|
+
if (forcedFakeCurrentUrl) {
|
132
|
+
url = forcedFakeCurrentUrl;
|
133
|
+
}
|
134
|
+
|
135
|
+
var urlWithTrailingSlash = url + "/";
|
136
|
+
var currentFirstLevelLink = links === null || links === void 0 ? void 0 : links.find(function (link) {
|
137
|
+
return urlWithTrailingSlash.includes(link.path);
|
138
|
+
}); // Bug: If the first link is the root, then it will be always set as active, since all paths include /
|
139
|
+
|
140
|
+
var currentSecondLevelLink = (_a = currentFirstLevelLink === null || currentFirstLevelLink === void 0 ? void 0 : currentFirstLevelLink.childItems) === null || _a === void 0 ? void 0 : _a.nodes.find(function (link) {
|
141
|
+
return urlWithTrailingSlash.includes(link.path);
|
142
|
+
});
|
143
|
+
setActiveFirstLevelLink(currentFirstLevelLink);
|
144
|
+
setActiveSecondLevelLink(currentSecondLevelLink);
|
145
|
+
}, []);
|
146
|
+
useEffect(function () {
|
147
|
+
setShowHeaderContent(true);
|
148
|
+
}, []);
|
149
|
+
useEffect(function () {
|
150
|
+
if (mobileMenuOpen) {
|
151
|
+
/* Disable scroll in body behind the menu */
|
152
|
+
document.body.style.overflow = 'hidden';
|
153
|
+
} else {
|
154
|
+
/* Enable scroll in body */
|
155
|
+
document.body.style.overflow = 'unset';
|
156
|
+
}
|
157
|
+
}, [mobileMenuOpen]); // TODO: Separate parts of the Header into own components, for example MobileNavigation etc
|
158
|
+
|
159
|
+
return jsx(HeaderContainer, __assign({
|
160
|
+
ref: ref,
|
161
|
+
mobileMenuOpen: mobileMenuOpen
|
162
|
+
}, {
|
163
|
+
children: showHeaderContent && jsxs(Fragment, {
|
164
|
+
children: [jsx(FlexContainer, {
|
165
|
+
children: jsxs(MainContainer, {
|
166
|
+
children: [disableLogoLink ? jsx(LogoContainer, {
|
167
|
+
children: logo ? logo : logoUrl ? jsx(Logo, {
|
168
|
+
src: logoUrl
|
169
|
+
}, void 0) : jsx(SLogo, {
|
170
|
+
color: "#00aa46"
|
171
|
+
}, void 0)
|
172
|
+
}, void 0) : jsx(LogoContainerLink, __assign({
|
173
|
+
href: getRootUrl()
|
174
|
+
}, {
|
175
|
+
children: logo ? logo : logoUrl ? jsx(Logo, {
|
176
|
+
src: logoUrl
|
177
|
+
}, void 0) : jsx(SLogo, {
|
178
|
+
color: "#00aa46"
|
179
|
+
}, void 0)
|
180
|
+
}), void 0), !mobile && jsxs(Fragment, {
|
181
|
+
children: [jsx(PrimaryContainer, {
|
182
|
+
children: jsx(FirstLevelLinksContainer, {
|
183
|
+
children: links === null || links === void 0 ? void 0 : links.map(function (link, i) {
|
184
|
+
return jsx(FirstLevelLink, __assign({
|
185
|
+
active: (activeFirstLevelLink === null || activeFirstLevelLink === void 0 ? void 0 : activeFirstLevelLink.path) === link.path,
|
186
|
+
href: link.path,
|
187
|
+
target: isExternalURL(link.path) ? '__blank' : '_self'
|
188
|
+
}, {
|
189
|
+
children: link.label
|
190
|
+
}), "first-level-link-" + i);
|
191
|
+
})
|
192
|
+
}, void 0)
|
193
|
+
}, void 0), jsxs(SecondaryContainer, {
|
194
|
+
children: [translations && hasMultipleTranslations() && jsx(LanguageSelector, {
|
195
|
+
translations: translations,
|
196
|
+
simple: false
|
197
|
+
}, void 0), children]
|
198
|
+
}, void 0)]
|
199
|
+
}, void 0), mobile && hasContent && jsx(HamburgerButton, __assign({
|
200
|
+
onClick: function onClick() {
|
201
|
+
return handleHamburgerClick();
|
202
|
+
}
|
203
|
+
}, {
|
204
|
+
children: jsx(HamburgerAnimation, {
|
205
|
+
mobileMenuOpen: mobileMenuOpen
|
206
|
+
}, void 0)
|
207
|
+
}), void 0)]
|
208
|
+
}, void 0)
|
209
|
+
}, void 0), !mobile && hasChildLinks(activeFirstLevelLink) && jsx(HeaderBottomBar, {
|
210
|
+
children: jsx(SecondLevelLinksContainer, {
|
211
|
+
children: (_c = (_b = activeFirstLevelLink === null || activeFirstLevelLink === void 0 ? void 0 : activeFirstLevelLink.childItems) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.map(function (item, i) {
|
212
|
+
return jsx(SecondLevelLink, __assign({
|
213
|
+
active: (activeSecondLevelLink === null || activeSecondLevelLink === void 0 ? void 0 : activeSecondLevelLink.path) === item.path,
|
214
|
+
id: item.path,
|
215
|
+
href: item.path,
|
216
|
+
target: isExternalURL(item.path) ? '__blank' : '_self'
|
217
|
+
}, {
|
218
|
+
children: item.label
|
219
|
+
}), "second-level-link-" + i);
|
220
|
+
})
|
221
|
+
}, void 0)
|
222
|
+
}, void 0), mobile && mobileMenuOpen && hasContent && jsxs(MobileNavigation, {
|
223
|
+
children: [jsx(FirstLevelLinksContainer, {
|
224
|
+
children: links === null || links === void 0 ? void 0 : links.map(function (firstLevelLink, i) {
|
225
|
+
var _a, _b;
|
226
|
+
|
227
|
+
return jsxs(React.Fragment, {
|
228
|
+
children: [jsxs(MobileLinksContainer, {
|
229
|
+
children: [(activeFirstLevelLink === null || activeFirstLevelLink === void 0 ? void 0 : activeFirstLevelLink.path) === firstLevelLink.path && activeSecondLevelLink === undefined ? jsx(FirstLevelLinkButton, __assign({
|
230
|
+
active: (activeFirstLevelLink === null || activeFirstLevelLink === void 0 ? void 0 : activeFirstLevelLink.path) === firstLevelLink.path,
|
231
|
+
onClick: function onClick() {
|
232
|
+
return setMobileMenuOpen(false);
|
233
|
+
}
|
234
|
+
}, {
|
235
|
+
children: firstLevelLink.label
|
236
|
+
}), "first-level-mobile-link-button-" + i) : jsx(FirstLevelLink, __assign({
|
237
|
+
active: (activeFirstLevelLink === null || activeFirstLevelLink === void 0 ? void 0 : activeFirstLevelLink.path) === firstLevelLink.path,
|
238
|
+
href: firstLevelLink.path,
|
239
|
+
target: isExternalURL(firstLevelLink.path) ? '__blank' : '_self'
|
240
|
+
}, {
|
241
|
+
children: firstLevelLink.label
|
242
|
+
}), "first-level-mobile-link-" + i), hasChildLinks(firstLevelLink) && jsx(ArrowButton, __assign({
|
243
|
+
onClick: function onClick() {
|
244
|
+
return handleMobileNavigationExpand(firstLevelLink);
|
245
|
+
},
|
246
|
+
open: (expandedMobileNavigationLink === null || expandedMobileNavigationLink === void 0 ? void 0 : expandedMobileNavigationLink.path) === firstLevelLink.path
|
247
|
+
}, {
|
248
|
+
children: jsx(ArrowDown, {}, void 0)
|
249
|
+
}), void 0)]
|
250
|
+
}, void 0), hasChildLinks(firstLevelLink) && jsx(CollapsingMobileLinksContainer, __assign({
|
251
|
+
expanded: (expandedMobileNavigationLink === null || expandedMobileNavigationLink === void 0 ? void 0 : expandedMobileNavigationLink.path) === firstLevelLink.path,
|
252
|
+
length: (_a = firstLevelLink === null || firstLevelLink === void 0 ? void 0 : firstLevelLink.childItems) === null || _a === void 0 ? void 0 : _a.nodes.length
|
253
|
+
}, {
|
254
|
+
children: jsx(SecondLevelLinksContainer, {
|
255
|
+
children: (_b = firstLevelLink === null || firstLevelLink === void 0 ? void 0 : firstLevelLink.childItems) === null || _b === void 0 ? void 0 : _b.nodes.map(function (secondLevelLink, i) {
|
256
|
+
return jsx(React.Fragment, {
|
257
|
+
children: (activeSecondLevelLink === null || activeSecondLevelLink === void 0 ? void 0 : activeSecondLevelLink.path) === secondLevelLink.path ? jsx(SecondLevelLinkButton, __assign({
|
258
|
+
active: (activeSecondLevelLink === null || activeSecondLevelLink === void 0 ? void 0 : activeSecondLevelLink.path) === secondLevelLink.path,
|
259
|
+
onClick: function onClick() {
|
260
|
+
return setMobileMenuOpen(false);
|
261
|
+
}
|
262
|
+
}, {
|
263
|
+
children: secondLevelLink.label
|
264
|
+
}), "second-level-mobile-link-button-" + i) : jsx(SecondLevelLink, __assign({
|
265
|
+
active: (activeSecondLevelLink === null || activeSecondLevelLink === void 0 ? void 0 : activeSecondLevelLink.path) === secondLevelLink.path,
|
266
|
+
href: secondLevelLink.path,
|
267
|
+
target: isExternalURL(secondLevelLink.path) ? '__blank' : '_self'
|
268
|
+
}, {
|
269
|
+
children: secondLevelLink.label
|
270
|
+
}), "second-level-mobile-link-" + i)
|
271
|
+
}, "second-level-mobile-link-container-" + i);
|
272
|
+
})
|
273
|
+
}, void 0)
|
274
|
+
}), void 0)]
|
275
|
+
}, "mobile-links-" + i);
|
276
|
+
})
|
277
|
+
}, void 0), (hasMultipleTranslations() || children) && jsxs(SecondaryContainer, {
|
278
|
+
children: [translations && hasMultipleTranslations() && jsx(LanguageSelector, {
|
279
|
+
translations: translations,
|
280
|
+
simple: true,
|
281
|
+
onClickActive: function onClickActive() {
|
282
|
+
return setMobileMenuOpen(false);
|
283
|
+
}
|
284
|
+
}, void 0), children]
|
285
|
+
}, void 0)]
|
286
|
+
}, void 0)]
|
287
|
+
}, void 0)
|
288
|
+
}), void 0);
|
289
|
+
});
|
290
|
+
export { Header, Header as default };
|
@@ -0,0 +1,314 @@
|
|
1
|
+
import { __makeTemplateObject } from '../../_virtual/_tslib.js';
|
2
|
+
import styled, { css } from 'styled-components';
|
3
|
+
import media from '../../styles/media.js';
|
4
|
+
var HeaderContainer = styled.header.withConfig({
|
5
|
+
displayName: "Headerstyles__HeaderContainer",
|
6
|
+
componentId: "sc-1mqz0r6-0"
|
7
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: sticky;\n top: 0;\n z-index: 100;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n padding: 0;\n box-shadow: ", ";\n background-color: ", ";\n width: 100%;\n border-top: ", ";\n\n /* Properties that change depending on the screen width (default mobile values) */\n height: ", ";\n overflow-y: auto;\n\n /* Properties that change depending on the screen width (desktop values) */\n ", "\n"], ["\n position: sticky;\n top: 0;\n z-index: 100;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n padding: 0;\n box-shadow: ", ";\n background-color: ", ";\n width: 100%;\n border-top: ", ";\n\n /* Properties that change depending on the screen width (default mobile values) */\n height: ", ";\n overflow-y: auto;\n\n /* Properties that change depending on the screen width (desktop values) */\n ", "\n"])), function (_a) {
|
8
|
+
var theme = _a.theme;
|
9
|
+
return theme.components.header.boxShadow;
|
10
|
+
}, function (_a) {
|
11
|
+
var theme = _a.theme;
|
12
|
+
return theme.components.header.mainContent.backgroundColor;
|
13
|
+
}, function (_a) {
|
14
|
+
var theme = _a.theme;
|
15
|
+
return theme.components.header.mainContent.borderTop;
|
16
|
+
}, function (_a) {
|
17
|
+
var mobileMenuOpen = _a.mobileMenuOpen;
|
18
|
+
return mobileMenuOpen ? '100vh' : 'auto';
|
19
|
+
}, media.desktop(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: auto;\n overflow-y: unset;\n "], ["\n height: auto;\n overflow-y: unset;\n "]))));
|
20
|
+
var FlexContainer = styled.div.withConfig({
|
21
|
+
displayName: "Headerstyles__FlexContainer",
|
22
|
+
componentId: "sc-1mqz0r6-1"
|
23
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n"], ["\n width: 100%;\n display: flex;\n"])));
|
24
|
+
var MainContainer = styled.div.withConfig({
|
25
|
+
displayName: "Headerstyles__MainContainer",
|
26
|
+
componentId: "sc-1mqz0r6-2"
|
27
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n width: 100% !important;\n justify-content: flex-start;\n align-items: center;\n column-gap: ", ";\n border-bottom: ", ";\n padding: ", ";\n\n ", "\n"], ["\n display: flex;\n flex-direction: row;\n width: 100% !important;\n justify-content: flex-start;\n align-items: center;\n column-gap: ", ";\n border-bottom: ", ";\n padding: ", ";\n\n ", "\n"])), function (_a) {
|
28
|
+
var theme = _a.theme;
|
29
|
+
return theme.spacings.spacing16;
|
30
|
+
}, function (_a) {
|
31
|
+
var theme = _a.theme;
|
32
|
+
return theme.components.header.mainContent.borderBottom;
|
33
|
+
}, function (_a) {
|
34
|
+
var theme = _a.theme;
|
35
|
+
return theme.spacings.spacing8 + " " + theme.spacings.spacing20;
|
36
|
+
}, media.desktop(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\t padding: ", ";\n "], ["\n\t padding: ", ";\n "])), function (_a) {
|
37
|
+
var theme = _a.theme;
|
38
|
+
return theme.spacings.spacing20;
|
39
|
+
}));
|
40
|
+
var PrimaryContainer = styled.div.withConfig({
|
41
|
+
displayName: "Headerstyles__PrimaryContainer",
|
42
|
+
componentId: "sc-1mqz0r6-3"
|
43
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: start;\n column-gap: ", ";\n align-items: center;\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: start;\n column-gap: ", ";\n align-items: center;\n"])), function (_a) {
|
44
|
+
var theme = _a.theme;
|
45
|
+
return theme.spacings.spacing16;
|
46
|
+
});
|
47
|
+
var SecondaryContainer = styled.div.withConfig({
|
48
|
+
displayName: "Headerstyles__SecondaryContainer",
|
49
|
+
componentId: "sc-1mqz0r6-4"
|
50
|
+
})(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n row-gap: ", ";\n\n /* Properties that change depending on screen width */\n margin: ", ";\n flex-direction: column-reverse;\n justify-content: center;\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n row-gap: ", ";\n\n /* Properties that change depending on screen width */\n margin: ", ";\n flex-direction: column-reverse;\n justify-content: center;\n\n ", "\n"])), function (_a) {
|
51
|
+
var theme = _a.theme;
|
52
|
+
return theme.spacings.spacing24;
|
53
|
+
}, function (_a) {
|
54
|
+
var theme = _a.theme;
|
55
|
+
return theme.spacings.spacing24 + " " + theme.spacings.spacing16;
|
56
|
+
}, media.desktop(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n column-gap: ", ";\n flex-direction: row;\n justify-content: end;\n margin:0;\n margin-left: auto;\n "], ["\n column-gap: ", ";\n flex-direction: row;\n justify-content: end;\n margin:0;\n margin-left: auto;\n "])), function (_a) {
|
57
|
+
var theme = _a.theme;
|
58
|
+
return theme.spacings.spacing16;
|
59
|
+
}));
|
60
|
+
var LogoContainer = styled.div.withConfig({
|
61
|
+
displayName: "Headerstyles__LogoContainer",
|
62
|
+
componentId: "sc-1mqz0r6-5"
|
63
|
+
})(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n"])));
|
64
|
+
var LogoContainerLink = styled.a.withConfig({
|
65
|
+
displayName: "Headerstyles__LogoContainerLink",
|
66
|
+
componentId: "sc-1mqz0r6-6"
|
67
|
+
})(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n"])));
|
68
|
+
var Logo = styled.img.withConfig({
|
69
|
+
displayName: "Headerstyles__Logo",
|
70
|
+
componentId: "sc-1mqz0r6-7"
|
71
|
+
})(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n height: ", ";\n"], ["\n height: ", ";\n"])), function (_a) {
|
72
|
+
var theme = _a.theme;
|
73
|
+
return theme.spacings.spacing48;
|
74
|
+
});
|
75
|
+
var FirstLevelLinksContainer = styled.div.withConfig({
|
76
|
+
displayName: "Headerstyles__FirstLevelLinksContainer",
|
77
|
+
componentId: "sc-1mqz0r6-8"
|
78
|
+
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n display: flex;\n align-items: left;\n justify-content: flex-start;\n flex-direction: column;\n margin: 0;\n column-gap: ", ";\n padding: ", ";\n\n ", "\n"], ["\n display: flex;\n align-items: left;\n justify-content: flex-start;\n flex-direction: column;\n margin: 0;\n column-gap: ", ";\n padding: ", ";\n\n ", "\n"])), function (_a) {
|
79
|
+
var theme = _a.theme;
|
80
|
+
return theme.spacings.spacing16;
|
81
|
+
}, function (_a) {
|
82
|
+
var theme = _a.theme;
|
83
|
+
return theme.spacings.spacing20;
|
84
|
+
}, media.desktop(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n padding: 0;\n "], ["\n flex-direction: row;\n align-items: center;\n padding: 0;\n "]))));
|
85
|
+
var firstLevelLinkStyles = css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: block;\n width: fit-content;\n padding: ", ";\n padding-left: 0;\n margin-right: ", ";\n text-decoration: none;\n\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n /* Properties that change depending on the link being active/inactive or hovered */\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: scaleX(0);\n transition: transform 0.1s ease-in;\n }\n\n :hover:after {\n transform: scaleX(1);\n }\n\n ", "\n\n ", "\n"], ["\n display: block;\n width: fit-content;\n padding: ", ";\n padding-left: 0;\n margin-right: ", ";\n text-decoration: none;\n\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n /* Properties that change depending on the link being active/inactive or hovered */\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: scaleX(0);\n transition: transform 0.1s ease-in;\n }\n\n :hover:after {\n transform: scaleX(1);\n }\n\n ", "\n\n ", "\n"])), function (_a) {
|
86
|
+
var theme = _a.theme;
|
87
|
+
return theme.spacings.spacing16;
|
88
|
+
}, function (_a) {
|
89
|
+
var theme = _a.theme;
|
90
|
+
return theme.spacings.spacing16;
|
91
|
+
}, function (_a) {
|
92
|
+
var theme = _a.theme;
|
93
|
+
return theme.components.header.firstLevelLink.font.fontFamily;
|
94
|
+
}, function (_a) {
|
95
|
+
var theme = _a.theme;
|
96
|
+
return theme.components.header.firstLevelLink.font.fontWeight;
|
97
|
+
}, function (_a) {
|
98
|
+
var theme = _a.theme;
|
99
|
+
return theme.components.header.firstLevelLink.font.fontSizes.mobile.fontSize;
|
100
|
+
}, function (_a) {
|
101
|
+
var theme = _a.theme;
|
102
|
+
return theme.components.header.firstLevelLink.font.fontSizes.mobile.lineHeight;
|
103
|
+
}, function (_a) {
|
104
|
+
var theme = _a.theme;
|
105
|
+
return theme.components.header.firstLevelLink.color.default;
|
106
|
+
}, function (_a) {
|
107
|
+
var theme = _a.theme;
|
108
|
+
return theme.components.header.firstLevelLink.color.hover;
|
109
|
+
}, function (_a) {
|
110
|
+
var theme = _a.theme;
|
111
|
+
return theme.components.header.firstLevelLink.color.hover;
|
112
|
+
}, function (_a) {
|
113
|
+
var active = _a.active;
|
114
|
+
return active && css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: ", ";\n transition: transform 0.1s ease-in;\n }\n :hover:after {\n transform: scaleX(1);\n }\n "], ["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: ", ";\n transition: transform 0.1s ease-in;\n }\n :hover:after {\n transform: scaleX(1);\n }\n "])), function (_a) {
|
115
|
+
var theme = _a.theme;
|
116
|
+
return theme.components.header.firstLevelLink.color.active;
|
117
|
+
}, function (_a) {
|
118
|
+
var theme = _a.theme;
|
119
|
+
return theme.components.header.firstLevelLink.color.hoverActive;
|
120
|
+
}, function (_a) {
|
121
|
+
var theme = _a.theme;
|
122
|
+
return theme.components.header.firstLevelLink.color.hoverActive;
|
123
|
+
}, function (_a) {
|
124
|
+
var theme = _a.theme;
|
125
|
+
return theme.components.header.activeLinkUnderline ? 'scaleX(1)' : 'scaleX(0)';
|
126
|
+
});
|
127
|
+
}, media.desktop(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n padding: ", " 0;\n margin:0;\n "], ["\n padding: ", " 0;\n margin:0;\n "])), function (_a) {
|
128
|
+
var theme = _a.theme;
|
129
|
+
return theme.spacings.spacing8;
|
130
|
+
}));
|
131
|
+
var FirstLevelLink = styled.a.withConfig({
|
132
|
+
displayName: "Headerstyles__FirstLevelLink",
|
133
|
+
componentId: "sc-1mqz0r6-9"
|
134
|
+
})(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), firstLevelLinkStyles);
|
135
|
+
var FirstLevelLinkButton = styled.button.withConfig({
|
136
|
+
displayName: "Headerstyles__FirstLevelLinkButton",
|
137
|
+
componentId: "sc-1mqz0r6-10"
|
138
|
+
})(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n background: transparent;\n border: none;\n\n ", "\n"], ["\n background: transparent;\n border: none;\n\n ", "\n"])), firstLevelLinkStyles);
|
139
|
+
var HeaderBottomBar = styled.div.withConfig({
|
140
|
+
displayName: "Headerstyles__HeaderBottomBar",
|
141
|
+
componentId: "sc-1mqz0r6-11"
|
142
|
+
})(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n display: flex;\n width: 100%;\n box-shadow: ", ";\n border-bottom: ", ";\n background-color: ", ";\n"], ["\n display: flex;\n width: 100%;\n box-shadow: ", ";\n border-bottom: ", ";\n background-color: ", ";\n"])), function (_a) {
|
143
|
+
var theme = _a.theme;
|
144
|
+
return theme.components.header.boxShadow;
|
145
|
+
}, function (_a) {
|
146
|
+
var theme = _a.theme;
|
147
|
+
return theme.components.header.bottomBar.borderBottom;
|
148
|
+
}, function (_a) {
|
149
|
+
var theme = _a.theme;
|
150
|
+
return theme.components.header.bottomBar.backgroundColor;
|
151
|
+
});
|
152
|
+
var SecondLevelLinksContainer = styled.div.withConfig({
|
153
|
+
displayName: "Headerstyles__SecondLevelLinksContainer",
|
154
|
+
componentId: "sc-1mqz0r6-12"
|
155
|
+
})(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n width: auto;\n z-index: 100;\n padding: ", ";\n\n flex-direction: column;\n row-gap: ", ";\n\n ", "\n"], ["\n display: flex;\n flex-wrap: wrap;\n width: auto;\n z-index: 100;\n padding: ", ";\n\n flex-direction: column;\n row-gap: ", ";\n\n ", "\n"])), function (_a) {
|
156
|
+
var theme = _a.theme;
|
157
|
+
return theme.spacings.spacing12 + " " + theme.spacings.spacing24;
|
158
|
+
}, function (_a) {
|
159
|
+
var theme = _a.theme;
|
160
|
+
return theme.spacings.spacing8;
|
161
|
+
}, media.desktop(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n flex-direction: row;\n column-gap: ", ";\n padding: ", ";\n "], ["\n flex-direction: row;\n column-gap: ", ";\n padding: ", ";\n "])), function (_a) {
|
162
|
+
var theme = _a.theme;
|
163
|
+
return theme.spacings.spacing16;
|
164
|
+
}, function (_a) {
|
165
|
+
var theme = _a.theme;
|
166
|
+
return theme.spacings.spacing12 + " " + theme.spacings.spacing20;
|
167
|
+
}));
|
168
|
+
var secondLevelLinkStyles = css(templateObject_25 || (templateObject_25 = __makeTemplateObject(["\n display: block;\n width: fit-content;\n padding: ", " 0;\n text-decoration: none;\n\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n /*\n Properties that change depending on the link being\n - mobile/desktop (default mobile values below)\n - inactive/active (default: inactive)\n - hovered\n\n */\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: scaleX(0);\n transition: transform 0.1s ease-in;\n }\n\n :hover:after {\n transform: scaleX(1);\n }\n\n ", "\n\n /*\n Properties that change depending on the link being\n - mobile/desktop (desktop values below)\n - inactive/active (default: inactive)\n - hovered\n */\n ", "\n"], ["\n display: block;\n width: fit-content;\n padding: ", " 0;\n text-decoration: none;\n\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n /*\n Properties that change depending on the link being\n - mobile/desktop (default mobile values below)\n - inactive/active (default: inactive)\n - hovered\n\n */\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: scaleX(0);\n transition: transform 0.1s ease-in;\n }\n\n :hover:after {\n transform: scaleX(1);\n }\n\n ", "\n\n /*\n Properties that change depending on the link being\n - mobile/desktop (desktop values below)\n - inactive/active (default: inactive)\n - hovered\n */\n ", "\n"])), function (_a) {
|
169
|
+
var theme = _a.theme;
|
170
|
+
return theme.spacings.spacing8;
|
171
|
+
}, function (_a) {
|
172
|
+
var theme = _a.theme;
|
173
|
+
return theme.components.header.secondLevelLink.font.fontFamily;
|
174
|
+
}, function (_a) {
|
175
|
+
var theme = _a.theme;
|
176
|
+
return theme.components.header.secondLevelLink.font.fontWeight;
|
177
|
+
}, function (_a) {
|
178
|
+
var theme = _a.theme;
|
179
|
+
return theme.components.header.secondLevelLink.font.fontSizes.mobile.fontSize;
|
180
|
+
}, function (_a) {
|
181
|
+
var theme = _a.theme;
|
182
|
+
return theme.components.header.secondLevelLink.font.fontSizes.mobile.lineHeight;
|
183
|
+
}, function (_a) {
|
184
|
+
var theme = _a.theme;
|
185
|
+
return theme.components.header.secondLevelLink.color.mobile.default;
|
186
|
+
}, function (_a) {
|
187
|
+
var theme = _a.theme;
|
188
|
+
return theme.components.header.secondLevelLink.color.mobile.hover;
|
189
|
+
}, function (_a) {
|
190
|
+
var theme = _a.theme;
|
191
|
+
return theme.components.header.secondLevelLink.color.mobile.hover;
|
192
|
+
}, function (_a) {
|
193
|
+
var active = _a.active;
|
194
|
+
return active && css(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: ", ";\n transition: transform 0.1s ease-in;\n }\n :hover:after {\n transform: scaleX(1);\n }\n "], ["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: ", ";\n transition: transform 0.1s ease-in;\n }\n :hover:after {\n transform: scaleX(1);\n }\n "])), function (_a) {
|
195
|
+
var theme = _a.theme;
|
196
|
+
return theme.components.header.secondLevelLink.color.mobile.active;
|
197
|
+
}, function (_a) {
|
198
|
+
var theme = _a.theme;
|
199
|
+
return theme.components.header.secondLevelLink.color.mobile.hoverActive;
|
200
|
+
}, function (_a) {
|
201
|
+
var theme = _a.theme;
|
202
|
+
return theme.components.header.secondLevelLink.color.mobile.hoverActive;
|
203
|
+
}, function (_a) {
|
204
|
+
var theme = _a.theme;
|
205
|
+
return theme.components.header.activeLinkUnderline ? 'scaleX(1)' : 'scaleX(0)';
|
206
|
+
});
|
207
|
+
}, media.desktop(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px\n ", ";\n transform: scaleX(0);\n transition: transform 0.1s ease-in;\n }\n\n :hover:after {\n transform: scaleX(1);\n }\n\n ", "\n "], ["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px\n ", ";\n transform: scaleX(0);\n transition: transform 0.1s ease-in;\n }\n\n :hover:after {\n transform: scaleX(1);\n }\n\n ", "\n "])), function (_a) {
|
208
|
+
var theme = _a.theme;
|
209
|
+
return theme.components.header.secondLevelLink.color.desktop.default;
|
210
|
+
}, function (_a) {
|
211
|
+
var theme = _a.theme;
|
212
|
+
return theme.components.header.secondLevelLink.color.desktop.hover;
|
213
|
+
}, function (_a) {
|
214
|
+
var theme = _a.theme;
|
215
|
+
return theme.components.header.secondLevelLink.color.desktop.hover;
|
216
|
+
}, function (_a) {
|
217
|
+
var active = _a.active;
|
218
|
+
return active && css(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: ", ";\n transition: transform 0.1s ease-in;\n }\n :hover:after {\n transform: scaleX(1);\n }\n "], ["\n color: ", ";\n\n :hover {\n filter: brightness(1);\n color: ", ";\n }\n\n :after {\n display: block;\n width: 100%;\n content: '';\n border-bottom: solid 1px ", ";\n transform: ", ";\n transition: transform 0.1s ease-in;\n }\n :hover:after {\n transform: scaleX(1);\n }\n "])), function (_a) {
|
219
|
+
var theme = _a.theme;
|
220
|
+
return theme.components.header.secondLevelLink.color.desktop.active;
|
221
|
+
}, function (_a) {
|
222
|
+
var theme = _a.theme;
|
223
|
+
return theme.components.header.secondLevelLink.color.desktop.hoverActive;
|
224
|
+
}, function (_a) {
|
225
|
+
var theme = _a.theme;
|
226
|
+
return theme.components.header.secondLevelLink.color.desktop.hoverActive;
|
227
|
+
}, function (_a) {
|
228
|
+
var theme = _a.theme;
|
229
|
+
return theme.components.header.activeLinkUnderline ? 'scaleX(1)' : 'scaleX(0)';
|
230
|
+
});
|
231
|
+
}));
|
232
|
+
var SecondLevelLink = styled.a.withConfig({
|
233
|
+
displayName: "Headerstyles__SecondLevelLink",
|
234
|
+
componentId: "sc-1mqz0r6-13"
|
235
|
+
})(templateObject_26 || (templateObject_26 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), secondLevelLinkStyles);
|
236
|
+
var SecondLevelLinkButton = styled.button.withConfig({
|
237
|
+
displayName: "Headerstyles__SecondLevelLinkButton",
|
238
|
+
componentId: "sc-1mqz0r6-14"
|
239
|
+
})(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n background: transparent;\n border: none;\n\n ", "\n"], ["\n background: transparent;\n border: none;\n\n ", "\n"])), secondLevelLinkStyles);
|
240
|
+
var HamburgerButton = styled.button.withConfig({
|
241
|
+
displayName: "Headerstyles__HamburgerButton",
|
242
|
+
componentId: "sc-1mqz0r6-15"
|
243
|
+
})(templateObject_28 || (templateObject_28 = __makeTemplateObject(["\n display: flex;\n border: none;\n background: transparent;\n height: 50px;\n cursor: pointer;\n margin-left: auto;\n"], ["\n display: flex;\n border: none;\n background: transparent;\n height: 50px;\n cursor: pointer;\n margin-left: auto;\n"])));
|
244
|
+
var HamburgerAnimation = styled.div.withConfig({
|
245
|
+
displayName: "Headerstyles__HamburgerAnimation",
|
246
|
+
componentId: "sc-1mqz0r6-16"
|
247
|
+
})(templateObject_30 || (templateObject_30 = __makeTemplateObject(["\n width: 30px;\n height: 2px;\n position: relative;\n transform: translateY(25px);\n background: ", ";\n transition: all 0ms 300ms;\n\n :after,\n :before {\n width: 30px;\n height: 2px;\n }\n\n :before {\n content: '';\n position: absolute;\n left: 0;\n bottom: ", ";\n background: ", ";\n transition: bottom 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n :after {\n content: '';\n position: absolute;\n left: 0;\n top: ", ";\n background: ", ";\n transition: top 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n ", "\n"], ["\n width: 30px;\n height: 2px;\n position: relative;\n transform: translateY(25px);\n background: ", ";\n transition: all 0ms 300ms;\n\n :after,\n :before {\n width: 30px;\n height: 2px;\n }\n\n :before {\n content: '';\n position: absolute;\n left: 0;\n bottom: ", ";\n background: ", ";\n transition: bottom 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n :after {\n content: '';\n position: absolute;\n left: 0;\n top: ", ";\n background: ", ";\n transition: top 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n\n ", "\n"])), function (_a) {
|
248
|
+
var mobileMenuOpen = _a.mobileMenuOpen,
|
249
|
+
theme = _a.theme;
|
250
|
+
return mobileMenuOpen ? 'rgba(0, 0, 0, 0)' : theme.components.header.hamburger.color;
|
251
|
+
}, function (_a) {
|
252
|
+
var theme = _a.theme;
|
253
|
+
return theme.spacings.spacing12;
|
254
|
+
}, function (_a) {
|
255
|
+
var theme = _a.theme;
|
256
|
+
return theme.components.header.hamburger.color;
|
257
|
+
}, function (_a) {
|
258
|
+
var theme = _a.theme;
|
259
|
+
return theme.spacings.spacing12;
|
260
|
+
}, function (_a) {
|
261
|
+
var theme = _a.theme;
|
262
|
+
return theme.components.header.hamburger.color;
|
263
|
+
}, function (_a) {
|
264
|
+
var mobileMenuOpen = _a.mobileMenuOpen;
|
265
|
+
return mobileMenuOpen && css(templateObject_29 || (templateObject_29 = __makeTemplateObject(["\n :after {\n top: 0;\n transform: rotate(45deg);\n transition: top 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n :before {\n bottom: 0;\n transform: rotate(-45deg);\n transition: bottom 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n "], ["\n :after {\n top: 0;\n transform: rotate(45deg);\n transition: top 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n :before {\n bottom: 0;\n transform: rotate(-45deg);\n transition: bottom 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n "])));
|
266
|
+
});
|
267
|
+
var MobileNavigation = styled.div.withConfig({
|
268
|
+
displayName: "Headerstyles__MobileNavigation",
|
269
|
+
componentId: "sc-1mqz0r6-17"
|
270
|
+
})(templateObject_31 || (templateObject_31 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n padding-bottom: 160px;\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n padding-bottom: 160px;\n"])));
|
271
|
+
var MobileLinksContainer = styled.div.withConfig({
|
272
|
+
displayName: "Headerstyles__MobileLinksContainer",
|
273
|
+
componentId: "sc-1mqz0r6-18"
|
274
|
+
})(templateObject_32 || (templateObject_32 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: solid 1px ", ";\n"], ["\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: solid 1px ", ";\n"])), function (_a) {
|
275
|
+
var theme = _a.theme;
|
276
|
+
return theme.components.header.mobileLinksContainer.color.bottomBorder;
|
277
|
+
});
|
278
|
+
var CollapsingMobileLinksContainer = styled.div.withConfig({
|
279
|
+
displayName: "Headerstyles__CollapsingMobileLinksContainer",
|
280
|
+
componentId: "sc-1mqz0r6-19"
|
281
|
+
})(templateObject_34 || (templateObject_34 = __makeTemplateObject(["\n /* constant 3 added to balance the animation speed when there are only a couple of items */\n --transition-time: ", ";\n\n overflow: hidden;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n /* Properties for transition */\n max-height: 0;\n border-bottom: solid 1px transparent;\n -webkit-transition: all var(--transition-time) ease;\n -moz-transition: all var(--transition-time) ease;\n transition: all var(--transition-time) ease-in-out;\n\n ", "\n"], ["\n /* constant 3 added to balance the animation speed when there are only a couple of items */\n --transition-time: ", ";\n\n overflow: hidden;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n /* Properties for transition */\n max-height: 0;\n border-bottom: solid 1px transparent;\n -webkit-transition: all var(--transition-time) ease;\n -moz-transition: all var(--transition-time) ease;\n transition: all var(--transition-time) ease-in-out;\n\n ", "\n"])), function (_a) {
|
282
|
+
var length = _a.length;
|
283
|
+
return length && (length + 3) * 0.025 + "s";
|
284
|
+
}, function (_a) {
|
285
|
+
var expanded = _a.expanded;
|
286
|
+
return expanded && css(templateObject_33 || (templateObject_33 = __makeTemplateObject(["\n /* 4 rem is approximately the height of one link element */\n max-height: ", ";\n border-bottom: solid 1px ", ";\n "], ["\n /* 4 rem is approximately the height of one link element */\n max-height: ", ";\n border-bottom: solid 1px ", ";\n "])), function (_a) {
|
287
|
+
var length = _a.length;
|
288
|
+
return length && length * 4 + "rem";
|
289
|
+
}, function (_a) {
|
290
|
+
var theme = _a.theme;
|
291
|
+
return theme.components.header.mobileLinksContainer.color.bottomBorder;
|
292
|
+
});
|
293
|
+
});
|
294
|
+
var ArrowButton = styled.button.withConfig({
|
295
|
+
displayName: "Headerstyles__ArrowButton",
|
296
|
+
componentId: "sc-1mqz0r6-20"
|
297
|
+
})(templateObject_35 || (templateObject_35 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n height: ", ";\n width: ", ";\n padding: ", ";\n background: transparent;\n border: none;\n\n flex: 1;\n justify-content: flex-end;\n\n svg {\n transform: ", ";\n transition: all 0.4s ease-in-out;\n\n path {\n fill: ", ";\n }\n }\n"], ["\n display: flex;\n align-items: center;\n height: ", ";\n width: ", ";\n padding: ", ";\n background: transparent;\n border: none;\n\n flex: 1;\n justify-content: flex-end;\n\n svg {\n transform: ", ";\n transition: all 0.4s ease-in-out;\n\n path {\n fill: ", ";\n }\n }\n"])), function (_a) {
|
298
|
+
var theme = _a.theme;
|
299
|
+
return theme.spacings.spacing32;
|
300
|
+
}, function (_a) {
|
301
|
+
var theme = _a.theme;
|
302
|
+
return theme.spacings.spacing48;
|
303
|
+
}, function (_a) {
|
304
|
+
var theme = _a.theme;
|
305
|
+
return theme.spacings.spacing8;
|
306
|
+
}, function (_a) {
|
307
|
+
var open = _a.open;
|
308
|
+
return open ? 'rotate(180deg)' : 'rotate(0deg)';
|
309
|
+
}, function (_a) {
|
310
|
+
var theme = _a.theme;
|
311
|
+
return theme.components.header.mobileArrowButton.color;
|
312
|
+
});
|
313
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35;
|
314
|
+
export { ArrowButton, CollapsingMobileLinksContainer, FirstLevelLink, FirstLevelLinkButton, FirstLevelLinksContainer, FlexContainer, HamburgerAnimation, HamburgerButton, HeaderBottomBar, HeaderContainer, Logo, LogoContainer, LogoContainerLink, MainContainer, MobileLinksContainer, MobileNavigation, PrimaryContainer, SecondLevelLink, SecondLevelLinkButton, SecondLevelLinksContainer, SecondaryContainer };
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { __rest, __assign } from '../../_virtual/_tslib.js';
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
3
|
+
import { forwardRef } from 'react';
|
4
|
+
import { StyledHeading } from './Heading.styles.js';
|
5
|
+
import { parseHtmlContent } from '../utils.js';
|
6
|
+
var Heading = forwardRef(function (_a, ref) {
|
7
|
+
var textAlign = _a.textAlign,
|
8
|
+
textColor = _a.textColor,
|
9
|
+
content = _a.content,
|
10
|
+
level = _a.level,
|
11
|
+
anchor = _a.anchor,
|
12
|
+
rest = __rest(_a, ["textAlign", "textColor", "content", "level", "anchor"]);
|
13
|
+
|
14
|
+
return jsx(Fragment, {
|
15
|
+
children: jsx(StyledHeading, __assign({
|
16
|
+
id: anchor,
|
17
|
+
// @ts-ignore
|
18
|
+
as: "h" + level,
|
19
|
+
textAlign: textAlign,
|
20
|
+
textColor: textColor,
|
21
|
+
dangerouslySetInnerHTML: {
|
22
|
+
__html: parseHtmlContent(content)
|
23
|
+
}
|
24
|
+
}, rest, {
|
25
|
+
ref: ref
|
26
|
+
}), void 0)
|
27
|
+
}, void 0);
|
28
|
+
});
|
29
|
+
export { Heading, Heading as default };
|