@hlf-fe/pulmo-ui 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/components/buttons/link-button/link-button.d.ts +25 -0
  2. package/dist/components/buttons/link-button/link-button.js +80 -0
  3. package/dist/components/buttons/link-button/link-button.stories.d.ts +6 -0
  4. package/dist/components/buttons/link-button/link-button.stories.js +17 -0
  5. package/dist/components/data-display/list/text-list/text-list.stories.d.ts +0 -0
  6. package/dist/components/data-display/list/text-list/text-list.stories.js +0 -0
  7. package/dist/components/layout/image-list/image-list.d.ts +6 -0
  8. package/dist/components/layout/image-list/image-list.js +55 -0
  9. package/dist/components/layout/image-list/image-list.stories.d.ts +6 -0
  10. package/dist/components/layout/image-list/image-list.stories.js +19 -0
  11. package/dist/components/modules/logo-list/logo-list.d.ts +5 -0
  12. package/dist/components/modules/logo-list/logo-list.js +34 -0
  13. package/dist/components/modules/logo-list/logo-list.stories.d.ts +6 -0
  14. package/dist/components/modules/logo-list/logo-list.stories.js +18 -0
  15. package/dist/components/modules/navigation/navigation-desktop/nav-cell/nav-cell.d.ts +6 -0
  16. package/dist/components/modules/navigation/navigation-desktop/nav-cell/nav-cell.js +69 -0
  17. package/dist/components/modules/navigation/navigation-desktop/nav-cell.d.ts +6 -0
  18. package/dist/components/modules/navigation/navigation-desktop/nav-cell.js +69 -0
  19. package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.d.ts +8 -0
  20. package/dist/components/modules/navigation/navigation-desktop/nav-section/nav-section.js +80 -0
  21. package/dist/components/modules/navigation/navigation-desktop/nav-section.d.ts +8 -0
  22. package/dist/components/modules/navigation/navigation-desktop/nav-section.js +80 -0
  23. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.d.ts +3 -0
  24. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.js +136 -0
  25. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.stories.d.ts +6 -0
  26. package/dist/components/modules/navigation/navigation-desktop/navigation-desktop.stories.js +12 -0
  27. package/dist/components/modules/navigation/navigation-mobile/nav-panel.d.ts +11 -0
  28. package/dist/components/modules/navigation/navigation-mobile/nav-panel.js +158 -0
  29. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.d.ts +3 -0
  30. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.js +97 -0
  31. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.stories.d.ts +6 -0
  32. package/dist/components/modules/navigation/navigation-mobile/navigation-mobile.stories.js +12 -0
  33. package/dist/components/modules/navigation/shared/nav-item/nav-item.d.ts +18 -0
  34. package/dist/components/modules/navigation/shared/nav-item/nav-item.js +106 -0
  35. package/dist/components/modules/navigation/shared/types/types.d.ts +43 -0
  36. package/dist/components/modules/navigation/shared/types/types.js +1 -0
  37. package/dist/components/modules/navigation/types.d.ts +39 -0
  38. package/dist/components/modules/navigation/types.js +1 -0
  39. package/dist/components/navigation/dropdown-menu/dropdown-menu.d.ts +0 -0
  40. package/dist/components/navigation/dropdown-menu/dropdown-menu.js +0 -0
  41. package/dist/components/navigation/nav-cell/navbar.d.ts +0 -0
  42. package/dist/components/navigation/nav-cell/navbar.js +0 -0
  43. package/dist/components/navigation/nav-section/dropdown-menu.d.ts +0 -0
  44. package/dist/components/navigation/nav-section/dropdown-menu.js +0 -0
  45. package/dist/components/navigation/nav-section/nav-section.d.ts +0 -0
  46. package/dist/components/navigation/nav-section/nav-section.js +0 -0
  47. package/dist/components/navigation/navbar/navbar.d.ts +0 -0
  48. package/dist/components/navigation/navbar/navbar.js +0 -0
  49. package/dist/index.d.ts +5 -5
  50. package/dist/index.js +6 -4
  51. package/dist/mocks/image-mocks.d.ts +7 -0
  52. package/dist/mocks/image-mocks.js +7 -0
  53. package/dist/mocks/navigation-mock.d.ts +5 -0
  54. package/dist/mocks/navigation-mock.js +153 -0
  55. package/dist/models/sanity.types.d.ts +9 -0
  56. package/dist/models/sanity.types.js +1 -0
  57. package/dist/models/web-page.url.d.ts +10 -0
  58. package/dist/models/web-page.url.js +1 -0
  59. package/package.json +1 -1
  60. package/dist/components/typography/heading/heading.d.ts +0 -4
  61. package/dist/components/typography/heading/heading.js +0 -47
  62. package/dist/components/typography/heading/heading.stories.d.ts +0 -7
  63. package/dist/components/typography/heading/heading.stories.js +0 -26
  64. package/dist/components/typography/heading/headings.d.ts +0 -4
  65. package/dist/components/typography/heading/headings.js +0 -47
  66. package/dist/components/typography/heading/headings.stories.d.ts +0 -7
  67. package/dist/components/typography/heading/headings.stories.js +0 -26
  68. package/dist/components/typography/portable-text/portable-text-default.d.ts +0 -39
  69. package/dist/components/typography/portable-text/portable-text-default.js +0 -23
  70. package/dist/styles/mixins/theme-mixins/theme-mixins.d.ts +0 -5
  71. package/dist/styles/mixins/theme-mixins/theme-mixins.js +0 -37
  72. /package/dist/components/{typography/portable-text/portable-text-component.d.ts → data-display/list/text-list/text-list.d.ts} +0 -0
  73. /package/dist/components/{typography/portable-text/portable-text-component.js → data-display/list/text-list/text-list.js} +0 -0
  74. /package/dist/components/layout/image/{image.stories.d.ts → Image.stories.d.ts} +0 -0
  75. /package/dist/components/layout/image/{image.stories.js → Image.stories.js} +0 -0
@@ -0,0 +1,136 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Link } from 'gatsby';
4
+ import { NavigationSection } from './nav-section/nav-section';
5
+ import { NavigationCell } from './nav-cell/nav-cell';
6
+ import { Image } from '../../../../components/layout/image/image';
7
+ import { Button } from '../../../../components/buttons/button/button';
8
+ import { ExternalIcon } from '../../../../components/icons/external-icon/external-icon';
9
+ import styled, { css } from 'styled-components';
10
+ import { rem } from '../../../../styles/units';
11
+ export const NavigationDesktop = ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText = {
12
+ ariaLabelHome: "",
13
+ }, isMenuVisible, menuRef }) => {
14
+ const [currentSection, setCurrentSection] = useState();
15
+ const [isSearchOpen, setIsSearchOpen] = useState(false);
16
+ const { ariaLabelHome } = localeText;
17
+ const onOpenSection = (section) => {
18
+ const sectionToShow = currentSection?.key !== section?.key ? section : undefined;
19
+ setCurrentSection(sectionToShow);
20
+ };
21
+ return (_jsxs(Wrapper, { ref: menuRef, children: [_jsxs(MenuContainer, { children: [!!topMenuItems?.length && (_jsx(TopBar, { "data-test": "nav-top-bar", children: topMenuItems.map(({ webUrlName, internalLink, externalUrl }) => (_jsx(StyledTopLink, { to: externalUrl || internalLink?.slug?.current || '/', children: webUrlName }, webUrlName))) })), _jsxs(NavBar, { children: [logotype && (_jsx(StyledLogoLink, { "data-test": "nav-logo", to: '/', "aria-label": ariaLabelHome, children: _jsx(Image, { image: logotype?.asset, width: "142", height: "35" }) })), _jsx(StyledList, { "data-test": "nav-list", children: mainMenuItems?.map(section => (_jsx(NavigationCell, { active: currentSection?.key === section.key, title: section.title, onToggleCell: () => onOpenSection(section) }, section.key))) }), ctaButton && (_jsxs(StyledButton, { dataTest: "nav-cta", to: ctaButton?.externalUrl, href: ctaButton?.internalLink?.slug?.current, children: [ctaButton.webUrlName, _jsx(IconWrapper, { children: _jsx(ExternalIcon, {}) })] }))] })] }), currentSection && (_jsx(StyledNavSection, { section: currentSection, closeSection: () => onOpenSection(undefined) })), (currentSection || isSearchOpen) && (_jsx(Overlay, { "data-test": "nav-overlay", "$isSearchOpen": isSearchOpen, "$playFadeOut": !isMenuVisible, onClick: () => {
22
+ onOpenSection(undefined);
23
+ setIsSearchOpen(false);
24
+ } }))] }));
25
+ };
26
+ const Wrapper = styled.nav `
27
+ position: relative;
28
+ display: flex;
29
+ flex-direction: column;
30
+ background: white;
31
+ z-index: 10;
32
+
33
+ a {
34
+ text-decoration: none;
35
+ }
36
+ `;
37
+ const MenuContainer = styled.div `
38
+ position: relative;
39
+ max-width: ${({ theme }) => theme.siteMaxWidth};
40
+ margin: 0 auto;
41
+ width: 100%;
42
+ `;
43
+ const Overlay = styled.div `
44
+ @keyframes fadeIn {
45
+ 0% {
46
+ opacity: 0;
47
+ }
48
+ 100% {
49
+ opacity: 1;
50
+ }
51
+ }
52
+
53
+ @keyframes fadeOut {
54
+ 0% {
55
+ opacity: 1;
56
+ }
57
+ 100% {
58
+ opacity: 0;
59
+ pointer-events: none;
60
+ }
61
+ }
62
+
63
+ position: fixed;
64
+ left: 0;
65
+ right: 0;
66
+ top: ${rem(128)};
67
+ bottom: 0;
68
+ background: rgba(0, 0, 0, 0.4);
69
+ cursor: pointer;
70
+ animation: fadeIn 0.2s forwards;
71
+
72
+ ${({ $isSearchOpen }) => $isSearchOpen &&
73
+ css `
74
+ top: ${rem(52)};
75
+ z-index: 2;
76
+ `}
77
+
78
+ ${({ $playFadeOut }) => $playFadeOut &&
79
+ css `
80
+ animation: fadeOut 0.2s forwards;
81
+ `}
82
+ `;
83
+ const TopBar = styled.div `
84
+ position: relative;
85
+ display: flex;
86
+ height: 52px;
87
+ justify-content: flex-end;
88
+ align-items: center;
89
+ background: white;
90
+ padding-right: ${rem(56)};
91
+ `;
92
+ const NavBar = styled.div `
93
+ position: relative;
94
+ display: flex;
95
+ height: 76px;
96
+ background: white;
97
+ padding: 0 ${rem(56)};
98
+ `;
99
+ const StyledButton = styled(Button) `
100
+ align-self: center;
101
+ white-space: nowrap;
102
+ `;
103
+ const IconWrapper = styled.span ``;
104
+ const StyledTopLink = styled(Link) `
105
+ font-size: ${rem(16)};
106
+ font-weight: 500;
107
+ margin: 0;
108
+ margin-right: ${rem(32)};
109
+
110
+ ${({ theme }) => css `
111
+ color: ${theme.blackLight};
112
+ font-family: ${theme.valueMedium};
113
+ `};
114
+
115
+ &:focus-visible {
116
+ outline: ${rem(2)} solid ${({ theme }) => theme.blackLight};
117
+ outline-offset: ${rem(2)};
118
+ border-radius: ${rem(2)};
119
+ }
120
+ `;
121
+ const StyledLogoLink = styled(Link) `
122
+ display: flex;
123
+ align-self: center;
124
+ margin-right: ${rem(16)};
125
+ `;
126
+ const StyledList = styled.ul `
127
+ margin: 0;
128
+ padding: 0;
129
+ margin-left: auto;
130
+ display: flex;
131
+ align-items: center;
132
+ `;
133
+ const StyledNavSection = styled(NavigationSection) `
134
+ top: 100%;
135
+ z-index: 1;
136
+ `;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { NavigationDesktop } from "./navigation-desktop";
3
+ declare const meta: Meta<typeof NavigationDesktop>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof NavigationDesktop>;
6
+ export declare const Default: Story;
@@ -0,0 +1,12 @@
1
+ import { NavigationDesktop } from "./navigation-desktop";
2
+ import { mockNavigation } from '../../../../mocks/navigation-mock';
3
+ const meta = {
4
+ title: "Modules/Main Navigation (Desktop)",
5
+ component: NavigationDesktop,
6
+ };
7
+ export default meta;
8
+ export const Default = {
9
+ args: {
10
+ ...mockNavigation
11
+ }
12
+ };
@@ -0,0 +1,11 @@
1
+ import { WebPageUrl } from "../../../../models/web-page-url";
2
+ import { NavigationSectionModel } from "../shared/types/types";
3
+ type Props = {
4
+ mainMenuItems?: NavigationSectionModel[];
5
+ topMenuItems?: WebPageUrl[];
6
+ scrollToTop: () => void;
7
+ closeMenu: () => void;
8
+ goBackText: string;
9
+ };
10
+ declare const NavigationPanel: ({ mainMenuItems, topMenuItems, scrollToTop, closeMenu, goBackText }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default NavigationPanel;
@@ -0,0 +1,158 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Link } from "gatsby";
4
+ import { ToggableChevron } from "../../../../components/icons/toggable-chevron/toggable-chevron";
5
+ import { CardBanner } from "../../../../components/surfaces/cards/card-banner/card-banner";
6
+ import { NavigationItem } from "../shared/nav-item/nav-item";
7
+ import styled, { css } from "styled-components";
8
+ import { rem } from '../../../../styles/units';
9
+ const NavigationPanel = ({ mainMenuItems, topMenuItems, scrollToTop, closeMenu, goBackText }) => {
10
+ const [currentSection, setCurrentSection] = useState();
11
+ const [currentItem, setCurrentItem] = useState();
12
+ const [isShowingSection, setIsShowingSection] = useState(false);
13
+ const [isAnimating, setIsAnimating] = useState(false);
14
+ const toggleSection = (section) => {
15
+ if (isAnimating)
16
+ return;
17
+ if (section) {
18
+ setCurrentSection(section);
19
+ }
20
+ setIsShowingSection(!!section);
21
+ setIsAnimating(true);
22
+ scrollToTop();
23
+ };
24
+ const toggleItem = (item) => {
25
+ setCurrentItem(currentItem?.key !== item?.key ? item : undefined);
26
+ };
27
+ const renderColumn = (title, items) => (items && (_jsxs(_Fragment, { children: [_jsx(Header, { children: title }), _jsx(StyledList, { children: items.map((item) => (_jsx(NavigationItem, { model: item, expanded: currentItem?.key === item.key, parent: currentSection?.title, onToggle: toggleItem, onLinkClick: closeMenu }, item.key))) })] })));
28
+ return (_jsxs(Wrapper, { "data-test": "nav-panel-wrapper", toggled: isShowingSection, onTransitionEnd: () => setIsAnimating(false), children: [_jsx(Panel, { visible: true, children: _jsxs(PanelLayout, { children: [_jsx(StyledList, { "data-test": "nav-list", children: mainMenuItems?.map((section) => (_jsx("li", { children: _jsxs(NavCell, { "data-test": "nav-cell", onClick: () => toggleSection(section), children: [_jsx("p", { children: section.title }), _jsx(Chevron, {})] }) }, section.key))) }), !!topMenuItems?.length && (_jsx(LinkContainer, { "data-test": "nav-sub-menu", children: topMenuItems.map(({ webUrlName, internalLink, externalUrl }) => (_jsx(StyledLink, { to: externalUrl || internalLink?.slug?.current || "/", children: webUrlName }, webUrlName))) }))] }) }), _jsxs(Panel, { "data-test": "nav-panel-section", visible: isShowingSection || isAnimating, children: [_jsxs(PanelLayout, { children: [_jsxs(BackCell, { "data-test": "nav-panel-back", onClick: () => toggleSection(undefined), children: [_jsx(BackChevron, { disableCircle: false }), goBackText] }), renderColumn(currentSection?.column1Title, currentSection?.column1Items), renderColumn(currentSection?.column2Title, currentSection?.column2Items)] }), _jsx(InfoWrapper, { color: currentSection?.backgroundColor?.hex, children: currentSection?.linkBanners && currentSection?.linkBanners?.map((banner) => (_jsx(CardBanner, { ...banner, externalUrl: banner?.link?.externalUrl, internalLink: banner?.link?.internalLink?.slug?.current, onClick: closeMenu }, banner.title.trim()))) })] })] }));
29
+ };
30
+ const Wrapper = styled.div `
31
+ width: 100%;
32
+ display: flex;
33
+ transform: translateX(0%);
34
+ transition: transform ease-in-out 0.6s;
35
+
36
+ ${({ toggled }) => toggled && css `
37
+ transform: translateX(-100%);
38
+ `}
39
+ `;
40
+ const Panel = styled.div `
41
+ width: 100vw;
42
+ display: flex;
43
+ flex-direction: column;
44
+ flex-shrink: 0;
45
+ display: none;
46
+
47
+ ${({ visible }) => visible && css `
48
+ display: block;
49
+ `}
50
+ `;
51
+ const PanelLayout = styled.div `
52
+ padding: ${rem(24)};
53
+ padding-bottom: ${rem(40)};
54
+ `;
55
+ const StyledList = styled.ul `
56
+ margin: 0;
57
+ padding: 0;
58
+ list-style: none;
59
+
60
+ li {
61
+ margin-bottom: ${rem(16)};
62
+
63
+ &:last-child {
64
+ margin-bottom: 0;
65
+ }
66
+ }
67
+ `;
68
+ const NavCell = styled.button `
69
+ padding: 0;
70
+ border: 0;
71
+ background: none;
72
+ cursor: pointer;
73
+ display: grid;
74
+ grid-template-columns: 1fr 22px;
75
+ align-items: center;
76
+ width: 100%;
77
+ font-size: ${rem(20)};
78
+
79
+ p {
80
+ font-size: inherit;
81
+ overflow: hidden;
82
+ text-overflow: ellipsis;
83
+ white-space: nowrap;
84
+ margin: 0;
85
+ text-align: left;
86
+ }
87
+
88
+ ${({ theme }) => css `
89
+ color: ${theme.blackLight};
90
+ font-family: ${theme.valueBold};
91
+ `};
92
+ `;
93
+ const Chevron = styled(ToggableChevron).attrs({
94
+ rotation: -90,
95
+ }) `
96
+ margin-left: auto;
97
+ `;
98
+ const BackCell = styled(NavCell) `
99
+ display: flex;
100
+ font-size: ${rem(16)};
101
+ width: fit-content;
102
+ `;
103
+ const BackChevron = styled(ToggableChevron).attrs({
104
+ rotation: -270,
105
+ }) `
106
+ margin-right: ${rem(4)};
107
+ `;
108
+ const LinkContainer = styled.div `
109
+ display: flex;
110
+ flex-direction: column;
111
+ padding-top: ${rem(32)};
112
+ `;
113
+ const StyledLink = styled(Link) `
114
+ font-size: ${rem(16)};
115
+ font-weight: 500;
116
+ margin: 0;
117
+
118
+ ${({ theme }) => css `
119
+ color: ${theme.blackLight};
120
+ font-family: ${theme.valueMedium};
121
+ `};
122
+
123
+ &:not(:last-child) {
124
+ margin-bottom: ${rem(24)};
125
+ };
126
+ `;
127
+ const Header = styled.h2 `
128
+ font-size: ${rem(20)};
129
+ margin: 0;
130
+ overflow: hidden;
131
+ white-space: nowrap;
132
+ text-overflow: ellipsis;
133
+ border-bottom: 1px solid ${({ theme }) => theme.grayPale};
134
+ padding-bottom: ${rem(8)};
135
+ margin-top: ${rem(30)};
136
+
137
+ ${({ theme }) => css `
138
+ color: ${theme.blackLight};
139
+ font-family: ${theme.valueBold};
140
+ `};
141
+ `;
142
+ const InfoWrapper = styled.div `
143
+ display: flex;
144
+ flex-direction: column;
145
+ justify-content: center;
146
+ padding: ${rem(32)} ${rem(15)};
147
+
148
+ ${({ color }) => color && css `
149
+ background-color: ${color};
150
+ `};
151
+
152
+ > * {
153
+ &:first-child {
154
+ margin-bottom: ${rem(16)};
155
+ }
156
+ }
157
+ `;
158
+ export default NavigationPanel;
@@ -0,0 +1,3 @@
1
+ import { NavigationModel } from '../shared/types/types';
2
+ export type NavigationMobileProps = NavigationModel;
3
+ export declare const NavigationMobile: ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText, }: NavigationMobileProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Link } from 'gatsby';
4
+ import NavigationPanel from './nav-panel';
5
+ import { Image } from '../../../../components/layout/image/image';
6
+ import { Button } from '../../../../components/buttons/button/button';
7
+ import { HamburgerIcon } from '../../../../components/icons/hamburger-icon/hamburger-icon';
8
+ import { MenuCloseIcon } from '../../../../components/icons/menu-close-icon/menu-close-icon';
9
+ import styled, { css } from 'styled-components';
10
+ import { rem } from '../../../../styles/units';
11
+ export const NavigationMobile = ({ logotype, mainMenuItems, topMenuItems, ctaButton, localeText = {
12
+ ariaLabelHome: "",
13
+ goBack: ""
14
+ }, }) => {
15
+ const { ariaLabelHome, goBack } = localeText;
16
+ const [isOpen, setIsOpen] = useState(false);
17
+ const stickyRef = useRef(null);
18
+ useEffect(() => {
19
+ document.body.style.overflow = isOpen ? 'hidden' : '';
20
+ }, [isOpen]);
21
+ // On Unmount, cleanup
22
+ useEffect(() => {
23
+ return () => {
24
+ document.body.style.overflow = '';
25
+ };
26
+ }, []);
27
+ const scrollToTop = () => {
28
+ stickyRef.current?.scroll({ top: 0, behavior: 'smooth' });
29
+ };
30
+ return (_jsx(Wrapper, { children: _jsxs(StickyContainer, { "$expanded": isOpen, ref: stickyRef, children: [_jsxs(TopBar, { children: [logotype && (_jsx(StyledLogoLink, { "data-test": "nav-logo", to: '/', "aria-label": ariaLabelHome, children: _jsx(Image, { image: logotype?.asset, width: "112", height: "28" }) })), ctaButton && (_jsx(StyledButton, { btnSize: "s", dataTest: "nav-cta", to: ctaButton.externalUrl, href: ctaButton.internalLink?.slug?.current, target: '_blank', children: ctaButton.webUrlName })), _jsx(MenuToggle, { "data-test": !isOpen ? 'nav-menu-closed' : 'nav-menu-open', "aria-label": "Meny", onClick: () => setIsOpen(!isOpen), children: _jsx(IconWrapper, { children: !isOpen ? _jsx(HamburgerIcon, {}) : _jsx(MenuCloseIcon, {}) }) })] }), isOpen && (_jsx(MenuContent, { children: _jsx(NavigationPanel, { mainMenuItems: mainMenuItems, topMenuItems: topMenuItems, scrollToTop: scrollToTop, closeMenu: () => setIsOpen(false), goBackText: goBack }) }))] }) }));
31
+ };
32
+ const Wrapper = styled.nav `
33
+ position: relative;
34
+ height: ${({ theme }) => rem(theme?.mobileNavHeight)};
35
+ width: 100%;
36
+ display: flex;
37
+ flex-direction: column;
38
+ z-index: 10;
39
+
40
+ a {
41
+ text-decoration: none;
42
+ }
43
+ `;
44
+ const StickyContainer = styled.div `
45
+ position: fixed;
46
+ width: 100%;
47
+ background: white;
48
+ overflow: hidden;
49
+ overflow-y: scroll;
50
+
51
+ ${({ $expanded }) => $expanded &&
52
+ css `
53
+ height: 100%;
54
+ `};
55
+ `;
56
+ const TopBar = styled.div `
57
+ height: ${({ theme }) => rem(theme?.mobileNavHeight)};
58
+ display: flex;
59
+ align-items: center;
60
+ padding: 0;
61
+ padding-left: ${rem(16)};
62
+ `;
63
+ const StyledLogoLink = styled(Link) `
64
+ display: flex;
65
+ align-self: center;
66
+
67
+ img {
68
+ height: ${rem(28)};
69
+ }
70
+ `;
71
+ const StyledButton = styled(Button) `
72
+ display: flex;
73
+ align-items: center;
74
+ margin-left: auto;
75
+ height: ${rem(32)};
76
+ padding: 0 ${rem(8)};
77
+ `;
78
+ const MenuToggle = styled.button `
79
+ display: flex;
80
+ align-items: center;
81
+ height: 100%;
82
+ margin: 0;
83
+ padding: 0 ${rem(16)};
84
+ border: none;
85
+ background: none;
86
+ cursor: pointer;
87
+ `;
88
+ const IconWrapper = styled.div `
89
+ display: flex;
90
+ width: ${rem(30)};
91
+ justify-content: center;
92
+ `;
93
+ const MenuContent = styled.div `
94
+ width: 100%;
95
+ border-top: 1px solid #ddd;
96
+ -webkit-tap-highlight-color: transparent;
97
+ `;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { NavigationMobile } from "./navigation-mobile";
3
+ declare const meta: Meta<typeof NavigationMobile>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof NavigationMobile>;
6
+ export declare const Default: Story;
@@ -0,0 +1,12 @@
1
+ import { NavigationMobile } from "./navigation-mobile";
2
+ import { mockNavigation } from '../../../../mocks/navigation-mock';
3
+ const meta = {
4
+ title: "Modules/Main Navigation (Mobile)",
5
+ component: NavigationMobile,
6
+ };
7
+ export default meta;
8
+ export const Default = {
9
+ args: {
10
+ ...mockNavigation
11
+ }
12
+ };
@@ -0,0 +1,18 @@
1
+ import { WebPageUrl } from '../../../../../models/web-page-url';
2
+ export type NavigationItemProps = {
3
+ model: NavigationItemModel;
4
+ expanded?: boolean;
5
+ parent?: string;
6
+ onToggle: (model: NavigationItemModel) => void;
7
+ onLinkClick?: () => void;
8
+ };
9
+ export type NavigationItemModel = {
10
+ key: string;
11
+ title: string;
12
+ highlight?: boolean;
13
+ slug?: {
14
+ current: string;
15
+ };
16
+ items?: WebPageUrl[];
17
+ };
18
+ export declare const NavigationItem: ({ model, expanded, onToggle, onLinkClick }: NavigationItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,106 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link } from "gatsby";
3
+ import styled, { css } from "styled-components";
4
+ import { media } from "../../../../../styles/mixins";
5
+ import { rem } from "../../../../../styles/units";
6
+ import { ToggableChevron } from "../../../../../components/icons/toggable-chevron/toggable-chevron";
7
+ import { HeartIcon } from "../../../../../components/icons/heart-icon/heart-icon";
8
+ export const NavigationItem = ({ model, expanded, onToggle, onLinkClick }) => {
9
+ const { highlight, title, items, slug } = model;
10
+ return (_jsxs(Wrapper, { "data-test": "nav-item", children: [slug ? (_jsxs(HeaderLink, { to: slug.current, onClick: () => {
11
+ onLinkClick?.();
12
+ }, children: [_jsx(Title, { active: highlight, children: title }), highlight && (_jsx(IconWrapper, { children: _jsx(HeartIcon, {}) }))] })) : (_jsxs(HeaderButton, { onClick: () => {
13
+ onToggle(model);
14
+ }, children: [_jsx(Title, { children: title }), _jsx(StyledToggle, { toggled: expanded, disableCircle: false })] })), (!slug && items) && (_jsx(Expandable, { "data-test": "nav-item-list", active: expanded, children: items.map(({ webUrlName, internalLink }) => (_jsx(StyledListItem, { children: _jsx(StyledLink, { tabIndex: !expanded ? -1 : 0, to: internalLink?.slug?.current ?? "", onClick: () => {
15
+ onLinkClick?.();
16
+ }, children: webUrlName }) }, webUrlName))) }))] }));
17
+ };
18
+ const Wrapper = styled.li `
19
+ display: flex;
20
+ flex-direction: column;
21
+ margin-top: ${rem(16)};
22
+ `;
23
+ const HeaderButton = styled.button `
24
+ display: flex;
25
+ flex-direction: row;
26
+ align-items: center;
27
+ cursor: pointer;
28
+ padding: 0;
29
+ border: 0;
30
+ background: none;
31
+ `;
32
+ const HeaderLink = styled(Link) `
33
+ display: flex;
34
+ flex-direction: row;
35
+ align-items: center;
36
+ cursor: pointer;
37
+ text-decoration: none;
38
+
39
+ svg {
40
+ flex-shrink: 0;
41
+ }
42
+ `;
43
+ const Title = styled.p `
44
+ font-size: ${rem(16)};
45
+ margin: 0;
46
+ margin-right: ${rem(8)};
47
+ text-align: left;
48
+
49
+ ${({ theme }) => css `
50
+ color: ${theme.blackLight};
51
+ font-family: ${theme.valueBold};
52
+ `};
53
+
54
+ ${({ active }) => active && css `
55
+ color: ${({ theme }) => theme.red};
56
+ `};
57
+
58
+ ${media.L `
59
+ font-size: ${rem(18)};
60
+ margin-right: ${rem(6)};
61
+ `}
62
+ `;
63
+ const IconWrapper = styled.div `
64
+ display: flex;
65
+
66
+ ${media.L `
67
+ margin-right: ${rem(20)};
68
+ `}
69
+ `;
70
+ const StyledToggle = styled(ToggableChevron) `
71
+ margin-left: auto;
72
+
73
+ ${media.L `
74
+ margin-right: ${rem(20)};
75
+ `}
76
+ `;
77
+ const Expandable = styled.ul `
78
+ position: relative;
79
+ display: flex;
80
+ flex-direction: column;
81
+ overflow: hidden;
82
+ margin: 0;
83
+ padding: 0;
84
+ display: none;
85
+
86
+ ${({ active }) => active && css `
87
+ display: block;
88
+ `};
89
+ `;
90
+ const StyledListItem = styled.li `
91
+ margin-top: ${rem(16)};
92
+ margin-left: ${rem(8)};
93
+ `;
94
+ const StyledLink = styled(Link) `
95
+ font-size: ${rem(16)};
96
+ text-decoration: none;
97
+
98
+ ${({ theme }) => css `
99
+ color: ${theme.blackLight};
100
+ font-family: ${theme.valueRegular};
101
+
102
+ ${media.L `
103
+ font-family: ${theme.valueMedium};
104
+ `}
105
+ `};
106
+ `;
@@ -0,0 +1,43 @@
1
+ import { WebPageUrl } from '../../../../../models/web-page-url';
2
+ import { SanityImage } from '../../../../../models/sanity-types';
3
+ import { RefObject } from "react";
4
+ export type NavigationItemModel = {
5
+ key: string;
6
+ title: string;
7
+ highlight?: boolean;
8
+ slug?: {
9
+ current: string;
10
+ };
11
+ items?: any;
12
+ };
13
+ export type NavigationSectionModel = {
14
+ key: string;
15
+ title: string;
16
+ column1Title?: string;
17
+ column1Items?: NavigationItemModel[];
18
+ column2Title?: string;
19
+ column2Items?: NavigationItemModel[];
20
+ backgroundColor?: {
21
+ hex: string;
22
+ };
23
+ linkBanners: LinkBanner[];
24
+ };
25
+ export type LinkBanner = {
26
+ title: string;
27
+ text: string;
28
+ image?: SanityImage;
29
+ link?: WebPageUrl;
30
+ };
31
+ export type NavigationModel = {
32
+ topMenuItems?: WebPageUrl[];
33
+ mainMenuItems?: NavigationSectionModel[];
34
+ logotype?: SanityImage;
35
+ ctaButton?: WebPageUrl;
36
+ __typename: string;
37
+ localeText?: {
38
+ ariaLabelHome?: string;
39
+ goBack?: string;
40
+ };
41
+ isMenuVisible?: boolean;
42
+ menuRef?: RefObject<HTMLElement>;
43
+ };
@@ -0,0 +1,39 @@
1
+ import { WebPageUrl } from '../../../models/web-page-url';
2
+ import { SanityImage } from '../../../models/sanity-types';
3
+ export type NavigationItemModel = {
4
+ key: string;
5
+ title: string;
6
+ highlight?: boolean;
7
+ link?: WebPageUrl;
8
+ items?: any;
9
+ };
10
+ export type NavigationSectionModel = {
11
+ key: string;
12
+ title: string;
13
+ column1Title?: string;
14
+ column1Items?: NavigationItemModel[];
15
+ column2Title?: string;
16
+ column2Items?: NavigationItemModel[];
17
+ backgroundColor?: {
18
+ hex: string;
19
+ };
20
+ linkBanners: LinkBanner[];
21
+ };
22
+ export type LinkBanner = {
23
+ title: string;
24
+ text: string;
25
+ image?: SanityImage;
26
+ link?: WebPageUrl;
27
+ };
28
+ export type NavigationModel = {
29
+ topMenuItems?: WebPageUrl[];
30
+ mainMenuItems?: NavigationSectionModel[];
31
+ logotype?: SanityImage;
32
+ ctaButton?: WebPageUrl;
33
+ __typename: string;
34
+ localeText?: {
35
+ ariaLabelHome?: string;
36
+ goBack?: string;
37
+ };
38
+ isMenuVisible?: boolean;
39
+ };
@@ -0,0 +1 @@
1
+ export {};
File without changes