@orangesk/orange-design-system 3.8.0 → 3.10.0
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/README.md +0 -6
- package/build/components/AnchorNavigation/style.css +1 -1
- package/build/components/AnchorNavigation/style.css.map +1 -1
- package/build/components/Carousel/style.css +1 -1
- package/build/components/Carousel/style.css.map +1 -1
- package/build/components/Footer/style.css +1 -1
- package/build/components/Footer/style.css.map +1 -1
- package/build/components/Megamenu/style.css +1 -1
- package/build/components/Megamenu/style.css.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/types/index.d.ts +6 -2
- package/build/lib/base.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/footer.css +1 -1
- package/build/lib/footer.css.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.css.map +1 -1
- package/build/lib/reset.css +2 -0
- package/build/lib/reset.css.map +1 -0
- package/build/lib/reset.js +3 -0
- package/build/lib/scripts.js +1 -1
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/megamenu-sprite-dark.svg +1 -0
- package/build/megamenu-sprite-light.svg +1 -0
- package/package.json +26 -33
- package/src/assets/megamenu/input-search.svg +1 -0
- package/src/assets/megamenu/input-valid.svg +1 -0
- package/src/assets/megamenu/logo-line.svg +5 -0
- package/src/assets/megamenu/megamenu-logo.svg +61 -0
- package/src/assets/megamenu/store-apple--white.svg +5 -0
- package/src/assets/megamenu/store-apple.svg +4 -0
- package/src/assets/megamenu/store-huawei--white.svg +5 -0
- package/src/assets/megamenu/store-huawei.svg +4 -0
- package/src/assets/megamenu/store-play--white.svg +7 -0
- package/src/assets/megamenu/store-play.svg +7 -0
- package/src/components/AnchorNavigation/styles/mixins.scss +7 -9
- package/src/components/BlockAction/CloneElementWithClassName.tsx +10 -7
- package/src/components/BlockAction/tests/CloneElementWithClassName.unit.test.jsx +28 -1
- package/src/components/Carousel/Carousel.static.ts +49 -0
- package/src/components/Carousel/Carousel.tsx +35 -12
- package/src/components/Carousel/constants.ts +2 -0
- package/src/components/Carousel/styles/mixins.scss +61 -0
- package/src/components/Carousel/styles/style.scss +7 -0
- package/src/components/Footer/Footer.tsx +1 -4
- package/src/components/Footer/styles/mixins.scss +3 -1
- package/src/components/Footer/styles/style.scss +31 -0
- package/src/components/Footer/tests/Footer.styles.unit.test.jsx +62 -0
- package/src/components/Forms/TextInput/styles/mixins.scss +4 -2
- package/src/components/Megamenu/Logo.tsx +7 -7
- package/src/components/Megamenu/LogoJeTu.tsx +6 -58
- package/src/components/Megamenu/MegaMenuIcon.tsx +20 -11
- package/src/components/Megamenu/Megamenu.tsx +58 -48
- package/src/components/Megamenu/MegamenuBlog.tsx +14 -2
- package/src/components/Megamenu/MegamenuSearchContent.tsx +13 -0
- package/src/components/Megamenu/MyOrangeMobilePanel.tsx +3 -9
- package/src/components/Megamenu/styles/mixins.scss +30 -38
- package/src/components/Megamenu/tests/Megamenu.unit.test.jsx +158 -0
- package/src/components/Alert/tests/Alert.visual.test.jsx +0 -137
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-custom-title-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-danger-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-full-width-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-success-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-buttons-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-description-buttons-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-description-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-warning-chromium-linux.png +0 -0
- package/src/components/CarouselHero/tests/CarouselHero.visual.test.jsx +0 -90
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
CLASS_ROOT,
|
|
18
18
|
CLASS_SCROLLBAR,
|
|
19
19
|
CLASS_SCROLLBAR_DRAG,
|
|
20
|
+
CLASS_SIDE_ARROWS,
|
|
21
|
+
CLASS_SIDE_ARROWS_VARIANT,
|
|
20
22
|
CLASS_TRACK,
|
|
21
23
|
CLASS_VIEWPORT,
|
|
22
24
|
CLASS_VIEWPORT_WRAPPER,
|
|
@@ -37,6 +39,8 @@ interface CarouselProps<T = ReactNode> extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
39
|
bleedRight?: boolean;
|
|
38
40
|
/** Make carousel bleed right from its root edge without bleeding left */
|
|
39
41
|
bleedRightNoLeft?: boolean;
|
|
42
|
+
/** Show navigation arrows beside the first visible slide */
|
|
43
|
+
showSideArrows?: boolean;
|
|
40
44
|
className?: string;
|
|
41
45
|
}
|
|
42
46
|
|
|
@@ -53,6 +57,7 @@ const Carousel = <T,>({
|
|
|
53
57
|
showScrollbar = false,
|
|
54
58
|
bleedRight = false,
|
|
55
59
|
bleedRightNoLeft = false,
|
|
60
|
+
showSideArrows = false,
|
|
56
61
|
...other
|
|
57
62
|
}: CarouselProps<T>) => {
|
|
58
63
|
const [carouselRef] = useStatic(CarouselStatic);
|
|
@@ -77,6 +82,7 @@ const Carousel = <T,>({
|
|
|
77
82
|
[`${CLASS_ROOT}--scrollbar`]: showScrollbar,
|
|
78
83
|
[`${CLASS_ROOT}--bleed-right`]: bleedRight,
|
|
79
84
|
[CLASS_BLEED_RIGHT_NO_LEFT]: bleedRightNoLeft,
|
|
85
|
+
[CLASS_SIDE_ARROWS_VARIANT]: showSideArrows,
|
|
80
86
|
});
|
|
81
87
|
|
|
82
88
|
const elementClasses = {
|
|
@@ -112,21 +118,38 @@ const Carousel = <T,>({
|
|
|
112
118
|
</div>
|
|
113
119
|
</div>
|
|
114
120
|
|
|
121
|
+
{showSideArrows && (
|
|
122
|
+
<div className={CLASS_SIDE_ARROWS}>
|
|
123
|
+
<Controls
|
|
124
|
+
className={elementClasses.prev}
|
|
125
|
+
icon="chevron-left"
|
|
126
|
+
aria-label="Naspäť"
|
|
127
|
+
/>
|
|
128
|
+
<Controls
|
|
129
|
+
className={elementClasses.next}
|
|
130
|
+
icon="chevron-right"
|
|
131
|
+
aria-label="Ďalej"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
|
|
115
136
|
{!showScrollbar && (
|
|
116
137
|
<div className={elementClasses.navigation}>
|
|
117
138
|
<div role="tablist" className={elementClasses.dots} />
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
{!showSideArrows && (
|
|
140
|
+
<div className={elementClasses.controls}>
|
|
141
|
+
<Controls
|
|
142
|
+
className={elementClasses.prev}
|
|
143
|
+
icon="chevron-left"
|
|
144
|
+
aria-label="Naspäť"
|
|
145
|
+
/>
|
|
146
|
+
<Controls
|
|
147
|
+
className={elementClasses.next}
|
|
148
|
+
icon="chevron-right"
|
|
149
|
+
aria-label="Ďalej"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
130
153
|
</div>
|
|
131
154
|
)}
|
|
132
155
|
|
|
@@ -11,6 +11,7 @@ export const CLASS_NEXT = `${CLASS_ROOT}__next`;
|
|
|
11
11
|
export const CLASS_DOTS = `${CLASS_ROOT}__pagination`;
|
|
12
12
|
export const CLASS_NAVIGATION = `${CLASS_ROOT}__navigation`;
|
|
13
13
|
export const CLASS_CONTROLS = `${CLASS_ROOT}__controls`;
|
|
14
|
+
export const CLASS_SIDE_ARROWS = `${CLASS_ROOT}__side-arrows`;
|
|
14
15
|
export const CLASS_DOT = `${CLASS_ROOT}__pagination-item`;
|
|
15
16
|
export const CLASS_SCROLLBAR = `${CLASS_ROOT}__scrollbar`;
|
|
16
17
|
export const CLASS_SCROLLBAR_HORIZONTAL = `${CLASS_ROOT}__scrollbar-horizontal`;
|
|
@@ -19,6 +20,7 @@ export const CLASS_ACTIVE = "is-active";
|
|
|
19
20
|
export const CLASS_SCROLLBAR_VARIANT = `${CLASS_ROOT}--scrollbar`;
|
|
20
21
|
export const CLASS_BLEED_RIGHT = `${CLASS_ROOT}--bleed-right`;
|
|
21
22
|
export const CLASS_BLEED_RIGHT_NO_LEFT = `${CLASS_ROOT}--bleed-right-no-left`;
|
|
23
|
+
export const CLASS_SIDE_ARROWS_VARIANT = `${CLASS_ROOT}--side-arrows`;
|
|
22
24
|
|
|
23
25
|
export const SELECTOR_VIEWPORT = `.${CLASS_VIEWPORT}`;
|
|
24
26
|
export const SELECTOR_TRACK = `.${CLASS_TRACK}`;
|
|
@@ -70,6 +70,67 @@
|
|
|
70
70
|
gap: convert.to-rem(8px);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
@mixin side-arrows {
|
|
74
|
+
position: absolute;
|
|
75
|
+
inset-block-start: 0;
|
|
76
|
+
inset-inline-start: 0;
|
|
77
|
+
z-index: 2;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: min(var(--carousel-side-arrows-height, 100%), 100vh);
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
|
|
85
|
+
&[hidden] {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.controls {
|
|
90
|
+
flex: 0 0 auto;
|
|
91
|
+
pointer-events: auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.controls.swiper-button-lock {
|
|
95
|
+
display: inline-flex;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.controls[disabled] {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.carousel__prev {
|
|
103
|
+
position: absolute;
|
|
104
|
+
inset-inline-start: 0;
|
|
105
|
+
top: 50%;
|
|
106
|
+
transform: translate(-50%, -50%);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.carousel__next {
|
|
110
|
+
position: absolute;
|
|
111
|
+
inset-inline-end: 0;
|
|
112
|
+
top: 50%;
|
|
113
|
+
transform: translate(50%, -50%);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include breakpoint.get("md", "down") {
|
|
117
|
+
width: var(--carousel-side-arrows-width, 100%);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@mixin centered-mobile-variant {
|
|
122
|
+
@include breakpoint.get("sm", "down") {
|
|
123
|
+
.carousel__slide {
|
|
124
|
+
width: calc(100% - 40px);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.carousel__side-arrows {
|
|
128
|
+
inset-inline-start: 20px;
|
|
129
|
+
width: calc(100% - 40px);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
73
134
|
@mixin track {
|
|
74
135
|
transform: translateZ(0);
|
|
75
136
|
width: 100%;
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
@include mixins.scrollbar-variant;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
&--side-arrows {
|
|
13
|
+
.carousel__side-arrows {
|
|
14
|
+
@include mixins.side-arrows;
|
|
15
|
+
}
|
|
16
|
+
@include mixins.centered-mobile-variant;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
&--bleed-right,
|
|
13
20
|
&--bleed-right-no-left {
|
|
14
21
|
@include mixins.bleed-right-variant;
|
|
@@ -140,10 +140,7 @@ const Footer: React.FC<FooterProps> = ({ className, data = footerData }) => {
|
|
|
140
140
|
id={`${accordionIdPrefix}-footer-section-panel-${index}`}
|
|
141
141
|
>
|
|
142
142
|
{column.links.map((link, linkIndex) => (
|
|
143
|
-
<li
|
|
144
|
-
className="mb-small"
|
|
145
|
-
key={`footer-link-${index}-${linkIndex}`}
|
|
146
|
-
>
|
|
143
|
+
<li key={`footer-link-${index}-${linkIndex}`}>
|
|
147
144
|
<a href={link.url}>{link.label}</a>
|
|
148
145
|
</li>
|
|
149
146
|
))}
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
@use "../../../styles/tools/convert";
|
|
4
4
|
@use "../../../styles/tokens/breakpoint";
|
|
5
5
|
@use "../../Megamenu/styles/mixins" as megamenuMixins;
|
|
6
|
+
@use "../../SocialButton/styles/config" as socialButtonConfig;
|
|
7
|
+
@use "../../SocialButton/styles/mixins" as socialButtonMixins;
|
|
8
|
+
@use "../../Icon/styles/mixins" as iconMixins;
|
|
6
9
|
|
|
7
10
|
#{config.$class-root} {
|
|
8
11
|
@include mixins.globals;
|
|
@@ -112,4 +115,32 @@
|
|
|
112
115
|
margin-bottom: convert.to-rem(30px);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
118
|
+
|
|
119
|
+
// Keep shared component styles local so the standalone bundle works on legacy pages.
|
|
120
|
+
.social-button {
|
|
121
|
+
@include socialButtonMixins.base;
|
|
122
|
+
@include socialButtonMixins.size;
|
|
123
|
+
|
|
124
|
+
&:hover,
|
|
125
|
+
&:focus,
|
|
126
|
+
&:active {
|
|
127
|
+
text-decoration: none;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@each $name, $props in socialButtonConfig.$social-colors {
|
|
132
|
+
.social-button--#{$name} {
|
|
133
|
+
@include socialButtonMixins.color($name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.icon {
|
|
138
|
+
@include iconMixins.base;
|
|
139
|
+
@include iconMixins.sizes;
|
|
140
|
+
@include iconMixins.colors;
|
|
141
|
+
|
|
142
|
+
use {
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
115
146
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as sass from "sass";
|
|
2
|
+
|
|
3
|
+
describe("Footer standalone styles", () => {
|
|
4
|
+
let stylesheet;
|
|
5
|
+
let rules;
|
|
6
|
+
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
stylesheet = document.createElement("style");
|
|
9
|
+
stylesheet.textContent = sass.compile(
|
|
10
|
+
"src/components/Footer/styles/style.scss",
|
|
11
|
+
).css;
|
|
12
|
+
document.head.append(stylesheet);
|
|
13
|
+
|
|
14
|
+
const flattenRules = (cssRules) =>
|
|
15
|
+
Array.from(cssRules).flatMap((rule) =>
|
|
16
|
+
rule.selectorText ? [rule] : flattenRules(rule.cssRules || []),
|
|
17
|
+
);
|
|
18
|
+
rules = flattenRules(stylesheet.sheet.cssRules);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
afterAll(() => stylesheet.remove());
|
|
22
|
+
|
|
23
|
+
const styleFor = (selector) =>
|
|
24
|
+
rules.find((rule) => rule.selectorText === selector)?.style;
|
|
25
|
+
|
|
26
|
+
it("sizes social buttons and icons without global ODS styles", () => {
|
|
27
|
+
expect(styleFor(".footer .social-button")?.display).toBe("inline-flex");
|
|
28
|
+
expect(styleFor(".footer .social-button")?.width).toBe("2.5rem");
|
|
29
|
+
expect(styleFor(".footer .icon")?.getPropertyValue("fill")).toBe(
|
|
30
|
+
"currentcolor",
|
|
31
|
+
);
|
|
32
|
+
expect(styleFor(".footer .icon")?.width).toBe("var(--icon-size)");
|
|
33
|
+
expect(styleFor(".footer .icon")?.height).toBe("var(--icon-size)");
|
|
34
|
+
expect(
|
|
35
|
+
styleFor(".footer .icon--medium")?.getPropertyValue("--icon-size"),
|
|
36
|
+
).toBe("1.5rem");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it.each(["facebook-2", "x", "linkedin-2", "youtube", "instagram"])(
|
|
40
|
+
"includes theme and interaction colors for %s",
|
|
41
|
+
(name) => {
|
|
42
|
+
const selector = `.footer .social-button--${name}`;
|
|
43
|
+
expect(styleFor(selector)?.color).toBe("var(--color-text-default)");
|
|
44
|
+
expect(styleFor(`${selector}:hover`)?.color).toBe("rgb(255, 255, 255)");
|
|
45
|
+
expect(styleFor(`${selector}:active, ${selector}.is-active`)?.color).toBe(
|
|
46
|
+
"var(--color-text-inverse)",
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
it("keeps reused component styles inside the footer", () => {
|
|
52
|
+
const componentRules = rules.filter((rule) =>
|
|
53
|
+
/\.(social-button|icon)\b/.test(rule.selectorText),
|
|
54
|
+
);
|
|
55
|
+
expect(componentRules.length).toBeGreaterThan(0);
|
|
56
|
+
for (const rule of componentRules) {
|
|
57
|
+
for (const selector of rule.selectorText.split(",")) {
|
|
58
|
+
expect(selector.trim()).toMatch(/^\.footer /);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
transform: translateZ(0);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
@mixin states($config: config.$states) {
|
|
13
|
+
@mixin states($config: config.$states, $valid-icon: true) {
|
|
14
14
|
@include generate.css-map($config, "default");
|
|
15
15
|
|
|
16
16
|
&:focus {
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
|
|
41
41
|
&.is-valid {
|
|
42
42
|
padding-right: convert.to-rem(36px);
|
|
43
|
-
|
|
43
|
+
@if $valid-icon {
|
|
44
|
+
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 15 15'%3E%3Cpath d='M7.5,15 C3.35786438,15 0,11.6421356 0,7.5 C0,3.35786438 3.35786438,0 7.5,0 C11.6421356,0 15,3.35786438 15,7.5 C15,11.6421356 11.6421356,15 7.5,15 Z M3.40550597,6.68901229 C2.99100286,7.0539857 2.95085113,7.6858763 3.31582458,8.1003794 L5.77477826,10.8930318 C6.1397517,11.3075349 6.7716423,11.3476866 7.18614541,10.9827132 C7.20478962,10.9662968 7.22281563,10.9491914 7.24018594,10.9314326 L11.8941565,6.17336831 C12.2803381,5.7785491 12.2733359,5.14542284 11.8785167,4.75924123 C11.4836975,4.37305961 10.8505712,4.38006176 10.4643896,4.77488097 L7.31720124,7.9924615 C6.93101963,8.3872807 6.29789337,8.3942828 5.90307416,8.0081012 C5.88531533,7.9907309 5.86820993,7.9727049 5.85179355,7.9540607 L4.81687313,6.77869369 C4.45189969,6.36419058 3.82000909,6.32403885 3.40550597,6.68901229 Z' fill='%2332c832' /%3E%3C/svg%3E");
|
|
45
|
+
}
|
|
44
46
|
background-size: convert.to-rem(16px);
|
|
45
47
|
background-position: calc(100% - #{convert.to-rem(10px)});
|
|
46
48
|
background-repeat: no-repeat;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { MegamenuIcon } from "./MegaMenuIcon";
|
|
2
|
+
|
|
1
3
|
export const Logo: React.FC = () => {
|
|
2
4
|
return (
|
|
3
|
-
<
|
|
5
|
+
<MegamenuIcon
|
|
6
|
+
name="logo-line"
|
|
7
|
+
width="40"
|
|
8
|
+
height="40"
|
|
4
9
|
viewBox="0 0 40 40"
|
|
5
|
-
fill="none"
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
7
10
|
aria-hidden="true"
|
|
8
|
-
|
|
9
|
-
<path d="M40 0H0V40H40V0Z" fill="#FF7900" />
|
|
10
|
-
<path d="M34.2897 28.57H5.71973V34.28H34.2897V28.57Z" fill="white" />
|
|
11
|
-
</svg>
|
|
11
|
+
/>
|
|
12
12
|
);
|
|
13
13
|
};
|
|
@@ -1,65 +1,13 @@
|
|
|
1
|
+
import { MegamenuIcon } from "./MegaMenuIcon";
|
|
2
|
+
|
|
1
3
|
export const LogoJeTu: React.FC = () => {
|
|
2
4
|
return (
|
|
3
|
-
<
|
|
5
|
+
<MegamenuIcon
|
|
6
|
+
name="megamenu-logo"
|
|
4
7
|
width="40"
|
|
5
8
|
height="67"
|
|
6
9
|
viewBox="0 0 40 67"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
>
|
|
10
|
-
<g clipPath="url(#clip0_21208_2750)">
|
|
11
|
-
<rect width="40" height="40" fill="white" />
|
|
12
|
-
<rect width="40" height="40" fill="#FF7900" />
|
|
13
|
-
<path
|
|
14
|
-
fillRule="evenodd"
|
|
15
|
-
clipRule="evenodd"
|
|
16
|
-
d="M35.4467 29.1254H36.0214V28.8803H34.5679V29.1254H35.1425V30.7169H35.4467V29.1254ZM38.1126 30.7169H38.4154V28.8859H37.9521L37.4126 30.2803L36.8647 28.8859H36.3971V30.7169H36.7V29.1831H36.7084L37.3098 30.7169H37.5014L38.1028 29.1831H38.1126V30.7169Z"
|
|
17
|
-
fill="white"
|
|
18
|
-
/>
|
|
19
|
-
<path
|
|
20
|
-
fillRule="evenodd"
|
|
21
|
-
clipRule="evenodd"
|
|
22
|
-
d="M30.2988 33.7648C30.2988 35.5929 31.2763 36.645 32.9143 36.645C34.0566 36.645 34.9045 36.231 35.3763 35.445L34.3045 34.8507C33.9622 35.3324 33.5974 35.5549 33.0439 35.5549C32.1833 35.5549 31.7467 35.0239 31.7354 33.9718H35.4354C35.4354 33.9274 35.4382 33.8817 35.441 33.8352C35.4438 33.7873 35.4467 33.7387 35.4467 33.6901C35.4467 31.8831 34.496 30.8619 32.8904 30.8619C31.2847 30.8619 30.2988 31.9366 30.2988 33.7648ZM32.8904 31.8507C33.5876 31.8507 34.0101 32.2873 34.0101 33.031H31.7636C31.8186 32.2732 32.2312 31.8507 32.8904 31.8507Z"
|
|
23
|
-
fill="white"
|
|
24
|
-
/>
|
|
25
|
-
<path
|
|
26
|
-
fillRule="evenodd"
|
|
27
|
-
clipRule="evenodd"
|
|
28
|
-
d="M29.4168 36.2296V30.969L28.1858 30.9718L28.0715 31.6068C27.9579 31.3346 27.5372 30.8676 26.4689 30.8676C25.2872 30.869 24.2351 31.9085 24.2351 33.7662C24.2351 35.6451 25.2562 36.5437 26.5506 36.5437C27.3999 36.5437 27.7534 36.1493 27.9858 35.7352L28.0055 35.7549V36.4014C28.0055 37.2704 27.6379 37.6338 26.8788 37.6338C26.0605 37.6338 25.8943 37.3606 25.8337 37.0873L24.39 37.3197C24.5929 38.2747 25.6055 38.7042 26.6971 38.7042C29.3464 38.6873 29.4168 37.1592 29.4168 36.2296ZM28.0114 33.4775C28.0114 34.2155 27.9184 35.3437 26.8086 35.3521C25.7353 35.3592 25.6874 34.2254 25.6874 33.538C25.6874 32.2859 26.2734 31.9028 26.7987 31.9028C27.5889 31.9028 28.0114 32.6099 28.0114 33.4775Z"
|
|
29
|
-
fill="white"
|
|
30
|
-
/>
|
|
31
|
-
<path
|
|
32
|
-
d="M18.2454 31.1366L19.4552 30.969L19.5876 31.6281C20.2707 31.1281 20.813 30.8619 21.4961 30.8619C22.6397 30.8619 23.2285 31.469 23.2285 32.6704V36.5394H21.7679V32.9253C21.7679 32.245 21.5904 31.9394 21.0637 31.9394C20.6271 31.9394 20.1918 32.1408 19.6961 32.5563V36.5422H18.2454V31.1366Z"
|
|
33
|
-
fill="white"
|
|
34
|
-
/>
|
|
35
|
-
<path
|
|
36
|
-
fillRule="evenodd"
|
|
37
|
-
clipRule="evenodd"
|
|
38
|
-
d="M13.8309 36.6085C14.4826 36.6109 15.1202 36.4186 15.6619 36.0563L15.7957 36.5451H17.0915V32.5169C17.0915 31.4958 16.2859 30.869 14.838 30.869C13.7769 30.8681 12.9873 31.2296 12.469 31.9535L13.4549 32.5169C13.7788 32.1009 14.2814 31.864 14.8084 31.8789C15.3746 31.8789 15.6816 32.1127 15.6816 32.5169V32.8254C13.3253 33.0916 12.1816 33.7507 12.1816 34.9944C12.1816 35.9183 12.7943 36.6085 13.8309 36.6085ZM14.2719 35.6099C13.8484 35.6099 13.6133 35.2614 13.6127 34.8887C13.6137 34.2319 14.2616 33.8816 15.6268 33.7085V35.024C15.1789 35.4183 14.7324 35.6099 14.2719 35.6099ZM13.6127 34.8887C13.6127 34.8882 13.6127 34.8878 13.6127 34.8873V34.8901C13.6127 34.8897 13.6127 34.8892 13.6127 34.8887Z"
|
|
39
|
-
fill="white"
|
|
40
|
-
/>
|
|
41
|
-
<path
|
|
42
|
-
d="M8.66626 30.9859H10.0564V31.6394C10.4387 31.1829 10.9929 30.905 11.5874 30.8718C11.6505 30.8702 11.7136 30.8735 11.7761 30.8817V32.2535H11.7057C11.0691 32.2535 10.3733 32.3521 10.1564 32.8465V36.5422H8.66626V30.9859Z"
|
|
43
|
-
fill="white"
|
|
44
|
-
/>
|
|
45
|
-
<path
|
|
46
|
-
fillRule="evenodd"
|
|
47
|
-
clipRule="evenodd"
|
|
48
|
-
d="M2.16504 33.7733C2.16504 35.7845 3.46786 36.7057 4.91433 36.7057C6.35941 36.7057 7.66363 35.7873 7.66363 33.7775C7.66363 31.7676 6.36081 30.8451 4.91433 30.8451C3.46786 30.8451 2.16504 31.762 2.16504 33.7733ZM3.61982 33.7676C3.61982 33.0634 3.82263 32.0775 4.91418 32.0775C6.00573 32.0775 6.20855 33.0564 6.20855 33.7676C6.20855 34.4789 6.00573 35.4648 4.91418 35.4648C3.82263 35.4648 3.61982 34.4719 3.61982 33.7676Z"
|
|
49
|
-
fill="white"
|
|
50
|
-
/>
|
|
51
|
-
</g>
|
|
52
|
-
<path
|
|
53
|
-
d="M5.17993 48.9411V58.7468C5.17993 59.2294 5.12534 59.648 5.01587 60.0016C4.91751 60.3582 4.73923 60.6555 4.47974 60.8903C4.23215 61.1371 3.89396 61.3132 3.46899 61.4225C3.04305 61.5441 2.50403 61.6052 1.85376 61.6052C1.55135 61.6051 1.27816 61.5807 1.03442 61.5319L0.994385 61.5241V59.3054L1.06079 59.3298C1.18497 59.3749 1.35889 59.3991 1.58423 59.3991C1.84115 59.3991 2.06033 59.3467 2.24341 59.2438L2.24731 59.2419C2.42503 59.1581 2.52466 58.961 2.52466 58.6208V48.9411H5.17993ZM11.8215 48.6891C12.6201 48.6892 13.3188 48.8463 13.9153 49.1628H13.9143C14.5087 49.4661 14.9946 49.8788 15.3713 50.4011C15.7594 50.9225 16.0387 51.5165 16.2083 52.1823C16.3776 52.8477 16.4372 53.5433 16.3889 54.2682L16.386 54.3151H9.67896C9.72114 55.1097 9.92735 55.6774 10.2903 56.029C10.6621 56.3892 11.1998 56.5729 11.9114 56.5729C12.4184 56.5729 12.8518 56.4489 13.2141 56.2038C13.5814 55.9431 13.7996 55.6758 13.8792 55.403L13.8899 55.3669H16.2463L16.2249 55.4323C15.8625 56.5556 15.3054 57.3652 14.5491 57.8532C13.7956 58.3393 12.8853 58.5807 11.8215 58.5807C11.0844 58.5807 10.418 58.4665 9.82349 58.236L9.82251 58.235C9.22844 57.9925 8.72398 57.653 8.31079 57.2155C7.89803 56.7784 7.57705 56.2565 7.34692 55.6511V55.6501C7.12873 55.044 7.01978 54.378 7.01978 53.653C7.01978 52.9515 7.13417 52.2972 7.3645 51.6911C7.59477 51.0852 7.92285 50.5629 8.3479 50.1257C8.77246 49.6771 9.27609 49.3254 9.85767 49.071C10.4525 48.816 11.1075 48.6891 11.8215 48.6891ZM32.8323 48.9411V54.2468C32.8323 55.0107 32.9514 55.5757 33.1838 55.9479L33.2776 56.072C33.516 56.3432 33.8932 56.4831 34.4202 56.4831C35.1064 56.4831 35.5924 56.2819 35.8918 55.8903C36.1938 55.4835 36.3499 54.8133 36.3499 53.8688V48.9411H39.0061V58.3474H36.4758V57.0866C36.1525 57.6029 35.739 57.981 35.2327 58.2165C34.7106 58.4592 34.1756 58.5807 33.6282 58.5807C33.0262 58.5807 32.5135 58.5119 32.092 58.3718L31.9172 58.3073C31.4784 58.1245 31.1284 57.8675 30.8704 57.5358V57.5349C30.6136 57.1925 30.4309 56.784 30.3215 56.3102L30.3206 56.3093C30.2238 55.8255 30.176 55.2933 30.176 54.7145V48.9411H32.8323ZM27.1672 46.1511V48.9411H29.0393V50.7507H27.1672V55.3093C27.1673 55.5226 27.1854 55.698 27.22 55.8366C27.2547 55.9753 27.3053 56.0741 27.3684 56.1374C27.4317 56.2007 27.5304 56.2521 27.6692 56.2868C27.8079 56.3215 27.9839 56.3386 28.1975 56.3386C28.34 56.3386 28.4764 56.3328 28.6067 56.321C28.7371 56.3091 28.8616 56.2919 28.9797 56.2682L29.0393 56.2556V58.3395L28.9973 58.3464C28.7791 58.3827 28.5372 58.4066 28.2717 58.4186C28.007 58.4307 27.7482 58.4372 27.4954 58.4372C27.0969 58.4372 26.7157 58.4069 26.3528 58.3464V58.3454C26 58.2965 25.6822 58.194 25.4006 58.0349L25.3997 58.0339C25.1276 57.873 24.9112 57.6445 24.7512 57.3493C24.5899 57.0515 24.511 56.664 24.511 56.1911V50.7507H22.9631V48.9411H24.511V46.1511H27.1672ZM11.7493 50.7145C11.3972 50.7146 11.098 50.7697 10.8499 50.8766L10.7463 50.9255C10.4885 51.0544 10.2774 51.2174 10.1145 51.4147C9.96176 51.6145 9.85162 51.8264 9.78149 52.0485L9.78052 52.0475C9.72728 52.2502 9.69466 52.4329 9.67993 52.5954H13.7219C13.601 51.9822 13.3928 51.5194 13.0989 51.2028L13.0979 51.2018C12.8106 50.8803 12.3645 50.7145 11.7493 50.7145ZM5.17993 45.3952V47.6013H2.52466V45.3952H5.17993Z"
|
|
54
|
-
fill="var(--color-text-default)"
|
|
55
|
-
stroke="var(--color-text-default)"
|
|
56
|
-
strokeWidth="0.1"
|
|
57
|
-
/>
|
|
58
|
-
<defs>
|
|
59
|
-
<clipPath id="clip0_21208_2750">
|
|
60
|
-
<rect width="40" height="40" fill="white" />
|
|
61
|
-
</clipPath>
|
|
62
|
-
</defs>
|
|
63
|
-
</svg>
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
/>
|
|
64
12
|
);
|
|
65
13
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import cx from "classnames";
|
|
2
4
|
import React from "react";
|
|
3
5
|
|
|
@@ -13,15 +15,31 @@ export interface MegaMenuIconProps extends React.SVGAttributes<SVGSVGElement> {
|
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const CLASS_ROOT = "megamenu-icon";
|
|
18
|
+
const MegamenuSpritePathContext = React.createContext(
|
|
19
|
+
"/megamenu-sprite-light.svg",
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const MegamenuSpritePathProvider = ({
|
|
23
|
+
children,
|
|
24
|
+
value,
|
|
25
|
+
}: {
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
value: string;
|
|
28
|
+
}) => (
|
|
29
|
+
<MegamenuSpritePathContext.Provider value={value}>
|
|
30
|
+
{children}
|
|
31
|
+
</MegamenuSpritePathContext.Provider>
|
|
32
|
+
);
|
|
16
33
|
|
|
17
34
|
const MegamenuIcon: React.FC<MegaMenuIconProps> = ({
|
|
18
35
|
className,
|
|
19
36
|
alt,
|
|
20
37
|
name,
|
|
21
|
-
spritePath
|
|
38
|
+
spritePath,
|
|
22
39
|
...other
|
|
23
40
|
}) => {
|
|
24
41
|
const classes = cx(CLASS_ROOT, className);
|
|
42
|
+
const themeSpritePath = React.useContext(MegamenuSpritePathContext);
|
|
25
43
|
|
|
26
44
|
return (
|
|
27
45
|
<svg
|
|
@@ -31,16 +49,7 @@ const MegamenuIcon: React.FC<MegaMenuIconProps> = ({
|
|
|
31
49
|
{...other}
|
|
32
50
|
>
|
|
33
51
|
{alt !== undefined && alt.length > 0 && <title>{alt}</title>}
|
|
34
|
-
{
|
|
35
|
-
<use
|
|
36
|
-
className={`${CLASS_ROOT}__use ${CLASS_ROOT}__use--light`}
|
|
37
|
-
xlinkHref={`${spritePath}#${name}`}
|
|
38
|
-
/>
|
|
39
|
-
{/* Dark theme version */}
|
|
40
|
-
<use
|
|
41
|
-
className={`${CLASS_ROOT}__use ${CLASS_ROOT}__use--dark`}
|
|
42
|
-
xlinkHref={`${spritePath}#${name}`}
|
|
43
|
-
/>
|
|
52
|
+
<use xlinkHref={`${spritePath ?? themeSpritePath}#${name}`} />
|
|
44
53
|
</svg>
|
|
45
54
|
);
|
|
46
55
|
};
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
import type { MegamenuTile, MenuItem, MenuSection } from "./data";
|
|
59
59
|
import { megamenuTiles, menuSections } from "./data";
|
|
60
60
|
import { getMegamenuIds } from "./ids";
|
|
61
|
-
import { MegamenuIcon } from "./MegaMenuIcon";
|
|
61
|
+
import { MegamenuIcon, MegamenuSpritePathProvider } from "./MegaMenuIcon";
|
|
62
62
|
import { MegamenuSearchContent } from "./MegamenuSearchContent";
|
|
63
63
|
import { MyOrangeMobilePanel } from "./MyOrangeMobilePanel";
|
|
64
64
|
import {
|
|
@@ -79,6 +79,8 @@ export type MegamenuProps = {
|
|
|
79
79
|
isB2B?: boolean;
|
|
80
80
|
/** Controls whether My Orange panel shows logged-in or logged-out content. */
|
|
81
81
|
isLoggedIn?: boolean;
|
|
82
|
+
/** Replaces My Orange panel triggers with links and omits the account panel. */
|
|
83
|
+
myOrangeHref?: string;
|
|
82
84
|
/** Number of items displayed on the cart badge. Empty cart when omitted or zero. */
|
|
83
85
|
cartItems?: number;
|
|
84
86
|
/** Shows an orange dot for a non-empty cart when item count is unavailable. */
|
|
@@ -229,6 +231,7 @@ export const Megamenu = ({
|
|
|
229
231
|
compactLogoOnly = false,
|
|
230
232
|
isB2B = false,
|
|
231
233
|
isLoggedIn = true,
|
|
234
|
+
myOrangeHref,
|
|
232
235
|
cartItems,
|
|
233
236
|
cartHasItems = false,
|
|
234
237
|
tiles = megamenuTiles,
|
|
@@ -239,7 +242,36 @@ export const Megamenu = ({
|
|
|
239
242
|
const hasCartItems = cartItems !== undefined && cartItems > 0;
|
|
240
243
|
const showCartDot = cartHasItems && !hasCartItems;
|
|
241
244
|
|
|
242
|
-
|
|
245
|
+
const myOrangeContent = (
|
|
246
|
+
<>
|
|
247
|
+
<MegamenuIcon
|
|
248
|
+
width={24}
|
|
249
|
+
height={24}
|
|
250
|
+
name="user"
|
|
251
|
+
className={CLASS_NAV_ICON}
|
|
252
|
+
aria-hidden="true"
|
|
253
|
+
/>
|
|
254
|
+
Môj Orange
|
|
255
|
+
</>
|
|
256
|
+
);
|
|
257
|
+
const myOrangeControl = myOrangeHref ? (
|
|
258
|
+
<a href={myOrangeHref} className={CLASS_NAV_BUTTON}>
|
|
259
|
+
{myOrangeContent}
|
|
260
|
+
</a>
|
|
261
|
+
) : (
|
|
262
|
+
<button
|
|
263
|
+
type="button"
|
|
264
|
+
className={CLASS_NAV_BUTTON}
|
|
265
|
+
data-megamenu-mobile-toggle
|
|
266
|
+
data-megamenu-mobile-target="my-orange"
|
|
267
|
+
aria-haspopup="dialog"
|
|
268
|
+
aria-expanded="false"
|
|
269
|
+
>
|
|
270
|
+
{myOrangeContent}
|
|
271
|
+
</button>
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
const content = (
|
|
243
275
|
<header>
|
|
244
276
|
<nav
|
|
245
277
|
className={cx(CLASS_ROOT, className, {
|
|
@@ -391,7 +423,7 @@ export const Megamenu = ({
|
|
|
391
423
|
<MegamenuIcon
|
|
392
424
|
width={16}
|
|
393
425
|
height={16}
|
|
394
|
-
name="rewards"
|
|
426
|
+
name="rewards-accent"
|
|
395
427
|
className={CLASS_NAV_ICON_CTA}
|
|
396
428
|
aria-hidden="true"
|
|
397
429
|
/>
|
|
@@ -468,25 +500,7 @@ export const Megamenu = ({
|
|
|
468
500
|
) : null}
|
|
469
501
|
</a>
|
|
470
502
|
</li>
|
|
471
|
-
<li className={CLASS_NAV_ITEM}>
|
|
472
|
-
<button
|
|
473
|
-
type="button"
|
|
474
|
-
className={CLASS_NAV_BUTTON}
|
|
475
|
-
data-megamenu-mobile-toggle
|
|
476
|
-
data-megamenu-mobile-target="my-orange"
|
|
477
|
-
aria-haspopup="dialog"
|
|
478
|
-
aria-expanded="false"
|
|
479
|
-
>
|
|
480
|
-
<MegamenuIcon
|
|
481
|
-
width={24}
|
|
482
|
-
height={24}
|
|
483
|
-
name="user"
|
|
484
|
-
className={CLASS_NAV_ICON}
|
|
485
|
-
aria-hidden="true"
|
|
486
|
-
/>
|
|
487
|
-
Môj Orange
|
|
488
|
-
</button>
|
|
489
|
-
</li>
|
|
503
|
+
<li className={CLASS_NAV_ITEM}>{myOrangeControl}</li>
|
|
490
504
|
<li className={cx(CLASS_NAV_ITEM, CLASS_HIDE_LG_UP)}>
|
|
491
505
|
<button
|
|
492
506
|
type="button"
|
|
@@ -639,7 +653,7 @@ export const Megamenu = ({
|
|
|
639
653
|
<MegamenuIcon
|
|
640
654
|
width={16}
|
|
641
655
|
height={16}
|
|
642
|
-
name="rewards"
|
|
656
|
+
name="rewards-accent"
|
|
643
657
|
className={CLASS_NAV_ICON_CTA}
|
|
644
658
|
aria-hidden="true"
|
|
645
659
|
/>
|
|
@@ -657,25 +671,7 @@ export const Megamenu = ({
|
|
|
657
671
|
role="group"
|
|
658
672
|
aria-labelledby="mobile-quick-access-heading"
|
|
659
673
|
>
|
|
660
|
-
<li className={CLASS_NAV_ITEM}>
|
|
661
|
-
<button
|
|
662
|
-
type="button"
|
|
663
|
-
className={CLASS_NAV_BUTTON}
|
|
664
|
-
data-megamenu-mobile-toggle
|
|
665
|
-
data-megamenu-mobile-target="my-orange"
|
|
666
|
-
aria-haspopup="dialog"
|
|
667
|
-
aria-expanded="false"
|
|
668
|
-
>
|
|
669
|
-
<MegamenuIcon
|
|
670
|
-
width={24}
|
|
671
|
-
height={24}
|
|
672
|
-
name="user"
|
|
673
|
-
className={CLASS_NAV_ICON}
|
|
674
|
-
aria-hidden="true"
|
|
675
|
-
/>
|
|
676
|
-
Môj Orange
|
|
677
|
-
</button>
|
|
678
|
-
</li>
|
|
674
|
+
<li className={CLASS_NAV_ITEM}>{myOrangeControl}</li>
|
|
679
675
|
<li className={CLASS_NAV_ITEM}>
|
|
680
676
|
<a href="/" className={CLASS_NAV_BUTTON}>
|
|
681
677
|
<MegamenuIcon
|
|
@@ -751,12 +747,14 @@ export const Megamenu = ({
|
|
|
751
747
|
</div>
|
|
752
748
|
</MegamenuMobilePanel>
|
|
753
749
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
750
|
+
{!myOrangeHref ? (
|
|
751
|
+
<MyOrangeMobilePanel
|
|
752
|
+
panelId={ids.myOrangePanelId}
|
|
753
|
+
titleId={ids.myOrangeTitleId}
|
|
754
|
+
isB2B={isB2B}
|
|
755
|
+
isLoggedIn={isLoggedIn}
|
|
756
|
+
/>
|
|
757
|
+
) : null}
|
|
760
758
|
|
|
761
759
|
<button
|
|
762
760
|
aria-label="Zatvoriť dropdown menu"
|
|
@@ -767,4 +765,16 @@ export const Megamenu = ({
|
|
|
767
765
|
<div className={CLASS_SPACER} aria-hidden="true" />
|
|
768
766
|
</header>
|
|
769
767
|
);
|
|
768
|
+
|
|
769
|
+
return (
|
|
770
|
+
<MegamenuSpritePathProvider
|
|
771
|
+
value={
|
|
772
|
+
isB2B || className?.split(/\s+/).includes("is-dark")
|
|
773
|
+
? "/megamenu-sprite-dark.svg"
|
|
774
|
+
: "/megamenu-sprite-light.svg"
|
|
775
|
+
}
|
|
776
|
+
>
|
|
777
|
+
{content}
|
|
778
|
+
</MegamenuSpritePathProvider>
|
|
779
|
+
);
|
|
770
780
|
};
|