@onsvisual/svelte-components 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,271 @@
1
+ function getBoolFromString(stringToConvert) {
2
+ return stringToConvert === "true";
3
+ }
4
+
5
+ function toggleSubnav(element) {
6
+ const subnav = element;
7
+ subnav.classList.toggle("js-expandable-active");
8
+ subnav.querySelectorAll(".js-expandable__content").forEach((el) => {
9
+ el.classList.toggle("js-nav-hidden");
10
+ });
11
+
12
+ const elementAria = getBoolFromString(element.querySelector("a:first-child").ariaExpanded);
13
+ subnav.querySelector("a:first-child").ariaExpanded = !elementAria;
14
+ const subnavAria = getBoolFromString(
15
+ element.querySelector(".js-expandable__content").ariaExpanded
16
+ );
17
+ subnav.querySelector(".js-expandable__content").ariaExpanded = !subnavAria;
18
+ }
19
+
20
+ function toggleMenu(toggleElement, menuElement) {
21
+ const toggle = toggleElement;
22
+ const menu = menuElement;
23
+ toggle.classList.toggle("menu-is-expanded");
24
+ const toggleAriaState = getBoolFromString(toggle.querySelector("a").ariaExpanded);
25
+ toggle.querySelector("a").ariaExpanded = !toggleAriaState;
26
+ menu.classList.toggle("nav-main--hidden");
27
+ const menuAriaState = getBoolFromString(menuElement.ariaExpanded);
28
+ menu.ariaExpanded = !menuAriaState;
29
+ }
30
+
31
+ function toggleSearch(toggleElement, searchElement) {
32
+ const toggle = toggleElement;
33
+ const search = searchElement;
34
+ const langAttribute = document.documentElement.lang;
35
+ toggle.classList.toggle("search-is-expanded");
36
+ const toggleAriaState = getBoolFromString(toggle.querySelector("a").ariaExpanded);
37
+ toggle.querySelector("a").ariaExpanded = !toggleAriaState;
38
+ let searchStr = "";
39
+ if (langAttribute === "en") {
40
+ searchStr = "Hide search";
41
+ if (toggle.querySelector(".nav--controls__text").textContent.includes("Hide")) {
42
+ searchStr = "Search";
43
+ }
44
+ } else {
45
+ searchStr = "Cuddio";
46
+ if (toggle.querySelector(".nav--controls__text").textContent.includes("Cuddio")) {
47
+ searchStr = "Chwilio";
48
+ }
49
+ }
50
+ toggle.querySelector(".nav--controls__text").textContent = searchStr;
51
+ search.classList.toggle("nav-search--hidden");
52
+ const searchAriaState = getBoolFromString(search.ariaExpanded);
53
+ search.ariaExpanded = !searchAriaState;
54
+ }
55
+
56
+ function cloneSecondaryNav() {
57
+ // On mobile move secondary nav items in header to primary nav
58
+ const navLink = document.querySelectorAll(".js-nav-clone__link");
59
+ const navList = document.querySelector(".js-nav-clone__list");
60
+
61
+ if (
62
+ document.body.classList.contains("viewport-sm") &&
63
+ navList.querySelectorAll(".js-nav-clone__link").length > 0
64
+ ) {
65
+ // Remove from separate UL and add into primary
66
+ navLink.forEach((l) => {
67
+ const link = l;
68
+ link.parentNode.style.display = "none";
69
+ const newNavItem = document.createElement("li");
70
+ newNavItem.classList.add("primary-nav__item");
71
+
72
+ link.classList.remove("secondary-nav__link");
73
+ link.classList.add("primary-nav__link", "col");
74
+
75
+ newNavItem.insertAdjacentElement("beforeend", link);
76
+
77
+ const primaryNavList = document.querySelector(".primary-nav__list li.primary-nav__language");
78
+ primaryNavList.insertAdjacentElement("beforebegin", newNavItem);
79
+ });
80
+ } else if (
81
+ !document.body.classList.contains("viewport-sm") &&
82
+ document.querySelector(".secondary-nav__item").style.display === "none"
83
+ ) {
84
+ // Remove from primary nav and add into separate secondary list
85
+ navLink.forEach((l, i) => {
86
+ const index = i + 1;
87
+ const link = l;
88
+ link.classList.add("secondary-nav__link");
89
+ link.classList.remove("primary-nav__link", "col");
90
+ link.parentNode.remove();
91
+ const cloneList = document.querySelector(`.js-nav-clone__list li:nth-child(${index})`);
92
+ cloneList.insertAdjacentElement("beforeend", link);
93
+ link.parentNode.style.display = "block";
94
+ });
95
+ }
96
+ }
97
+
98
+ function clonePrimaryItems() {
99
+ const detectDuplicate = document.querySelectorAll(".js-nav__duplicate");
100
+ const expandableList = document.querySelectorAll(".js-expandable");
101
+
102
+ // Clone primary nav items into sub-menu on mobile, so it can still be selected on mobile
103
+ if (document.body.classList.contains("viewport-sm") && detectDuplicate.length === 0) {
104
+ expandableList.forEach((item) => {
105
+ const href = item.querySelector("a").getAttribute("href");
106
+ const text = item.querySelector(".submenu-title").innerText;
107
+ const childList = item.querySelector(".js-expandable__content");
108
+
109
+ const newLink = document.createElement("a");
110
+ newLink.classList.add("primary-nav__child-link");
111
+ newLink.href = href;
112
+ newLink.innerText = text.trim();
113
+
114
+ const newItem = document.createElement("li");
115
+ newItem.classList.add("primary-nav__child-item", "js-nav__duplicate", "js-expandable__child");
116
+ newItem.insertAdjacentElement("beforeend", newLink);
117
+ childList.insertBefore(newItem, childList.firstChild);
118
+ });
119
+ } else if (!document.body.classList.contains("viewport-sm") && detectDuplicate.length > 0) {
120
+ detectDuplicate.forEach((duplicate) => {
121
+ duplicate.remove();
122
+ });
123
+ }
124
+ }
125
+
126
+ export default function initNav() {
127
+ window.addEventListener("resize", () => {
128
+ clonePrimaryItems();
129
+ cloneSecondaryNav();
130
+ });
131
+
132
+ document.addEventListener("keydown", (e) => {
133
+ if (e.key === "Escape") {
134
+ // Find all nav items currently hovered (with open submenu)
135
+ document.querySelectorAll(".primary-nav__item:hover > ul").forEach((submenu) => {
136
+ submenu.classList.add("ons-u-hidden");
137
+ const parentItem = submenu.closest(".primary-nav__item");
138
+ // Handler to restore submenu on mouse leave
139
+ const handleMouseLeave = () => {
140
+ submenu.classList.remove("ons-u-hidden");
141
+ parentItem.removeEventListener("mouseleave", handleMouseLeave);
142
+ };
143
+ parentItem.addEventListener("mouseleave", handleMouseLeave, { once: true });
144
+ });
145
+ }
146
+ });
147
+
148
+ const primaryNav = document.querySelector("#nav-primary");
149
+ const searchBar = document.querySelector("#searchBar");
150
+ const navItem = document.querySelectorAll(".js-nav");
151
+ const expandableItems = document.querySelectorAll(".js-expandable");
152
+
153
+ clonePrimaryItems();
154
+ cloneSecondaryNav();
155
+
156
+ primaryNav.classList.add("nav-main--hidden");
157
+ primaryNav.ariaExpanded = false;
158
+
159
+ expandableItems.forEach((item) => {
160
+ item.addEventListener("click", (event) => {
161
+ if (document.body.classList.contains("viewport-sm")) {
162
+ event.preventDefault();
163
+ toggleSubnav(item);
164
+ }
165
+ });
166
+ });
167
+
168
+ // stop parent element from taking over all click events
169
+ document.querySelectorAll(".js-expandable > .js-expandable__content").forEach((elem) => {
170
+ elem.addEventListener("click", (event) => {
171
+ event.stopPropagation();
172
+ });
173
+ });
174
+
175
+ navItem.forEach((item) => {
176
+ item.addEventListener("keydown", (e) => {
177
+ const focusedItem = document.querySelector(".js-expandable__child a:focus"); // only selects child item that is in focus
178
+ const keycode = e.keyCode;
179
+ const up = 38;
180
+ const down = 40;
181
+ const right = 39;
182
+ const left = 37;
183
+ const esc = 27;
184
+ const tab = 9;
185
+ if (keycode === tab && focusedItem) {
186
+ item.classList.remove("primary-nav__item--focus");
187
+ item.nextElementSibling?.focus();
188
+ }
189
+ if (keycode === esc) {
190
+ item.classList.remove("primary-nav__item--focus");
191
+ const closestNav = item.closest(".js-nav");
192
+ const link = closestNav.querySelector("a");
193
+ link.classList.add("hide-children");
194
+ link.focus();
195
+ link.addEventListener("focusout", () => {
196
+ link.classList.remove("hide-children");
197
+ });
198
+ }
199
+ if (keycode === down) {
200
+ e.preventDefault();
201
+ item.classList.add("primary-nav__item--focus");
202
+ if (focusedItem) {
203
+ focusedItem.parentElement.nextElementSibling?.querySelector("a").focus();
204
+ } else {
205
+ item.querySelector(".js-expandable__child a")?.focus();
206
+ }
207
+ }
208
+ if (keycode === up) {
209
+ e.preventDefault();
210
+ if (focusedItem && focusedItem.parentElement.previousElementSibling) {
211
+ focusedItem.parentElement.previousElementSibling?.querySelector("a").focus();
212
+ } else {
213
+ item.classList.remove("primary-nav__item--focus");
214
+ item.querySelector("a")?.focus();
215
+ }
216
+ }
217
+ if (keycode === right) {
218
+ e.preventDefault();
219
+ item.classList.remove("primary-nav__item--focus");
220
+ const closestNav = item.closest(".js-nav");
221
+ closestNav.nextElementSibling?.querySelector("a").focus();
222
+ }
223
+ if (keycode === left) {
224
+ e.preventDefault();
225
+ item.classList.remove("primary-nav__item--focus");
226
+ const closestNav = item.closest(".js-nav");
227
+ closestNav.previousElementSibling?.querySelector("a").focus();
228
+ }
229
+ });
230
+ });
231
+
232
+ const expandBehaviour = (item, expandedBool) => {
233
+ if (!document.body.classList.contains("viewport-sm")) {
234
+ const navLink = item.querySelector(".primary-nav__link");
235
+ navLink.ariaExpanded = expandedBool;
236
+ const expandable = item.querySelector(".js-expandable__content");
237
+ expandable.ariaExpanded = expandedBool;
238
+ }
239
+ };
240
+
241
+ expandableItems.forEach((item) => {
242
+ item.addEventListener("focusin", () => expandBehaviour(item, true));
243
+ item.addEventListener("pointerenter", () => expandBehaviour(item, true));
244
+ });
245
+
246
+ expandableItems.forEach((item) => {
247
+ item.addEventListener("focusout", () => expandBehaviour(item, false));
248
+ item.addEventListener("pointerleave", () => expandBehaviour(item, false));
249
+ });
250
+
251
+ const menuToggle = document.querySelector("#menu-toggle");
252
+ const menuToggleContainer = menuToggle.parentNode;
253
+ const searchToggle = document.querySelector("#search-toggle");
254
+ const searchToggleContainer = searchToggle.parentNode;
255
+
256
+ menuToggle.addEventListener("click", (event) => {
257
+ event.preventDefault();
258
+ if (!searchBar.classList.contains("nav-search--hidden")) {
259
+ toggleSearch(searchToggleContainer, searchBar);
260
+ }
261
+ toggleMenu(menuToggleContainer, primaryNav);
262
+ });
263
+
264
+ searchToggle.addEventListener("click", (event) => {
265
+ event.preventDefault();
266
+ if (!primaryNav.classList.contains("nav-main--hidden")) {
267
+ toggleMenu(menuToggleContainer, primaryNav);
268
+ }
269
+ toggleSearch(searchToggleContainer, searchBar);
270
+ });
271
+ }
@@ -5,7 +5,7 @@
5
5
  import componentDocs from "./docs/component.md?raw";
6
6
 
7
7
  const { Story } = defineMeta({
8
- title: "Information and media/Indent",
8
+ title: "Decorators/Indent",
9
9
  component: Indent,
10
10
  tags: ["autodocs"],
11
11
  argTypes: {},
@@ -7,6 +7,11 @@
7
7
  * @type {string}
8
8
  */
9
9
  export let title = "Share this page";
10
+ /**
11
+ * Which platforms to include (available options "facebook", "x", "linkedin" and "email")
12
+ * @type {string[]}
13
+ */
14
+ export let platforms = ["facebook", "linkedin", "x", "email"];
10
15
  /**
11
16
  * Adds margin above section
12
17
  * @type {boolean}
@@ -35,97 +40,105 @@
35
40
  <Container width="wide" {marginTop} {marginBottom} {cls}>
36
41
  <h2 class="ons-u-fs-r--b ons-u-mb-2xs">{title}</h2>
37
42
  <ul class="ons-list ons-list--inline ons-list--icons">
38
- <li class="ons-list__item">
39
- <span class="ons-list__prefix" aria-hidden="true">
40
- <svg
41
- class="ons-icon ons-icon--2xl"
42
- id="icon-facebook"
43
- viewBox="0 0 32 32"
44
- xmlns="http://www.w3.org/2000/svg"
45
- focusable="false"
46
- aria-hidden="true"
47
- role="img"
48
- title="ons-icon-facebook"
43
+ {#if platforms.includes("facebook")}
44
+ <li class="ons-list__item">
45
+ <span class="ons-list__prefix" aria-hidden="true">
46
+ <svg
47
+ class="ons-icon ons-icon--2xl"
48
+ id="icon-facebook"
49
+ viewBox="0 0 32 32"
50
+ xmlns="http://www.w3.org/2000/svg"
51
+ focusable="false"
52
+ aria-hidden="true"
53
+ role="img"
54
+ title="ons-icon-facebook"
55
+ >
56
+ <path
57
+ d="M32,16.0986285 C32.0009185,7.5342974 25.337417,0.468462963 16.8372092,0.0203294753 C8.33700136,-0.427804013 0.97607758,5.89865855 0.0874346352,14.4161886 C-0.801208309,22.9337186 5.09355054,30.6602611 13.5009524,31.9979281 L13.5009524,20.7518951 L9.44,20.7518951 L9.44,16.0986285 L13.5009524,16.0986285 L13.5009524,12.549267 C13.5009524,8.5169471 15.8857143,6.28613892 19.5428571,6.28613892 C20.742535,6.30277426 21.9393895,6.40782423 23.1238095,6.60044523 L23.1238095,10.5637711 L21.1047619,10.5637711 C19.1161905,10.5637711 18.4990476,11.8056643 18.4990476,13.0782216 L18.4990476,16.0986285 L22.9409524,16.0986285 L22.2247619,20.7518951 L18.4990476,20.7518951 L18.4990476,31.9979281 C26.2735701,30.760956 31.9991507,24.0182672 32,16.0986285 L32,16.0986285 Z"
58
+ />
59
+ </svg></span
60
+ ><a
61
+ href="https://www.facebook.com/sharer/sharer.php?u={href}"
62
+ class="ons-list__link"
63
+ target="_blank">Facebook<span class="ons-u-vh"> (opens in a new tab)</span></a
49
64
  >
50
- <path
51
- d="M32,16.0986285 C32.0009185,7.5342974 25.337417,0.468462963 16.8372092,0.0203294753 C8.33700136,-0.427804013 0.97607758,5.89865855 0.0874346352,14.4161886 C-0.801208309,22.9337186 5.09355054,30.6602611 13.5009524,31.9979281 L13.5009524,20.7518951 L9.44,20.7518951 L9.44,16.0986285 L13.5009524,16.0986285 L13.5009524,12.549267 C13.5009524,8.5169471 15.8857143,6.28613892 19.5428571,6.28613892 C20.742535,6.30277426 21.9393895,6.40782423 23.1238095,6.60044523 L23.1238095,10.5637711 L21.1047619,10.5637711 C19.1161905,10.5637711 18.4990476,11.8056643 18.4990476,13.0782216 L18.4990476,16.0986285 L22.9409524,16.0986285 L22.2247619,20.7518951 L18.4990476,20.7518951 L18.4990476,31.9979281 C26.2735701,30.760956 31.9991507,24.0182672 32,16.0986285 L32,16.0986285 Z"
52
- />
53
- </svg></span
54
- ><a
55
- href="https://www.facebook.com/sharer/sharer.php?u={href}"
56
- class="ons-list__link"
57
- target="_blank">Facebook<span class="ons-u-vh"> (opens in a new tab)</span></a
58
- >
59
- </li>
60
- <li class="ons-list__item">
61
- <span class="ons-list__prefix" aria-hidden="true">
62
- <svg
63
- class="ons-icon ons-icon--2xl"
64
- id="icon-twitter"
65
- viewBox="0 0 90.01 90.01"
66
- xmlns="http://www.w3.org/2000/svg"
67
- focusable="false"
68
- aria-hidden="true"
69
- role="img"
70
- title="ons-icon-twitter"
65
+ </li>
66
+ {/if}
67
+ {#if platforms.includes("linkedin")}
68
+ <li class="ons-list__item">
69
+ <span class="ons-list__prefix" aria-hidden="true">
70
+ <svg
71
+ class="ons-icon ons-icon--2xl"
72
+ id="icon-linkedin"
73
+ viewBox="0 0 32 32"
74
+ xmlns="http://www.w3.org/2000/svg"
75
+ focusable="false"
76
+ aria-hidden="true"
77
+ role="img"
78
+ title="ons-icon-linkedin"
79
+ >
80
+ <path
81
+ d="M16,-3.41060513e-13 C20.2434638,-3.41060513e-13 24.3131264,1.68570945 27.3137085,4.6862915 C30.3142906,7.68687356 32,11.7565362 32,16 C32,24.836556 24.836556,32 16,32 C7.163444,32 0,24.836556 0,16 C0,7.163444 7.163444,-3.41060513e-13 16,-3.41060513e-13 Z M11.3505859,12.4641113 L7.45385744,12.4641113 L7.45385744,24.1875 L11.3505859,24.1875 L11.3505859,12.4641113 Z M20.9152832,12.1889649 C18.8479004,12.1889649 17.9213867,13.3251953 17.4035644,14.1240234 L17.4035644,14.1240234 L17.4035644,12.4641113 L13.5070801,12.4641113 C13.5212538,12.7696262 13.5275532,13.809993 13.5292593,15.1533871 L13.5293118,16.8832762 C13.5292156,16.9843911 13.5291048,17.0860852 13.5289803,17.1882303 L13.5280782,17.8054916 L13.5280782,17.8054916 L13.5268961,18.427439 C13.5216699,20.9164121 13.5108442,23.3704557 13.5078578,24.0208157 L13.5070801,24.1875 L17.4035644,24.1875 L17.4035644,17.640625 C17.4035644,17.2902832 17.4287109,16.9401856 17.5317382,16.6896972 C17.8134766,15.9897461 18.4545899,15.2646484 19.5310059,15.2646484 C20.940918,15.2646484 21.5051269,16.3395996 21.5051269,17.9157715 L21.5051269,17.9157715 L21.5051269,24.1875 L25.4013672,24.1875 L25.4013672,17.465332 C25.4013672,13.8645019 23.4790039,12.1889649 20.9152832,12.1889649 Z M9.42822263,6.8125 C8.09521488,6.8125 7.22363281,7.68774412 7.22363281,8.83813475 C7.22363281,9.96313475 8.06933594,10.8632812 9.37695313,10.8632812 L9.37695313,10.8632812 L9.40234375,10.8632812 C10.7612305,10.8632812 11.6069336,9.96313475 11.6069336,8.83813475 C11.581543,7.68774412 10.7612305,6.8125 9.42822263,6.8125 Z"
82
+ />
83
+ </svg>
84
+ </span><a
85
+ href="https://www.linkedin.com/sharing/share-offsite/?url={href}"
86
+ class="ons-list__link"
87
+ target="_blank">LinkedIn<span class="ons-u-vh"> (opens in a new tab)</span></a
71
88
  >
72
- <polygon points="24.89,23.01 57.79,66.99 65.24,66.99 32.34,23.01" />
73
- <path
74
- d="M 45 0 L 45 0 C 20.147 0 0 20.147 0 45 v 0 c 0 24.853 20.147 45 45 45 h 0 c 24.853 0 45 -20.147 45 -45 v 0 C 90 20.147 69.853 0 45 0 z M 56.032 70.504 L 41.054 50.477 L 22.516 70.504 h -4.765 L 38.925 47.63 L 17.884 19.496 h 16.217 L 47.895 37.94 l 17.072 -18.444 h 4.765 L 50.024 40.788 l 22.225 29.716 H 56.032 z"
75
- />
76
- </svg></span
77
- ><a
78
- href="https://x.com/intent/post?text={pageTitle}&url={href}"
79
- class="ons-list__link"
80
- target="_blank">Twitter<span class="ons-u-vh"> (opens in a new tab)</span></a
81
- >
82
- </li>
83
- <li class="ons-list__item">
84
- <span class="ons-list__prefix" aria-hidden="true">
85
- <svg
86
- class="ons-icon ons-icon--2xl"
87
- id="icon-linkedin"
88
- viewBox="0 0 32 32"
89
- xmlns="http://www.w3.org/2000/svg"
90
- focusable="false"
91
- aria-hidden="true"
92
- role="img"
93
- title="ons-icon-linkedin"
89
+ </li>
90
+ {/if}
91
+ {#if platforms.includes("x")}
92
+ <li class="ons-list__item">
93
+ <span class="ons-list__prefix" aria-hidden="true">
94
+ <svg
95
+ class="ons-icon ons-icon--2xl"
96
+ id="icon-twitter"
97
+ viewBox="0 0 90.01 90.01"
98
+ xmlns="http://www.w3.org/2000/svg"
99
+ focusable="false"
100
+ aria-hidden="true"
101
+ role="img"
102
+ title="ons-icon-twitter"
103
+ >
104
+ <polygon points="24.89,23.01 57.79,66.99 65.24,66.99 32.34,23.01" />
105
+ <path
106
+ d="M 45 0 L 45 0 C 20.147 0 0 20.147 0 45 v 0 c 0 24.853 20.147 45 45 45 h 0 c 24.853 0 45 -20.147 45 -45 v 0 C 90 20.147 69.853 0 45 0 z M 56.032 70.504 L 41.054 50.477 L 22.516 70.504 h -4.765 L 38.925 47.63 L 17.884 19.496 h 16.217 L 47.895 37.94 l 17.072 -18.444 h 4.765 L 50.024 40.788 l 22.225 29.716 H 56.032 z"
107
+ />
108
+ </svg></span
109
+ ><a
110
+ href="https://x.com/intent/post?text={pageTitle}&url={href}"
111
+ class="ons-list__link"
112
+ target="_blank">X<span class="ons-u-vh"> (opens in a new tab)</span></a
94
113
  >
95
- <path
96
- d="M16,-3.41060513e-13 C20.2434638,-3.41060513e-13 24.3131264,1.68570945 27.3137085,4.6862915 C30.3142906,7.68687356 32,11.7565362 32,16 C32,24.836556 24.836556,32 16,32 C7.163444,32 0,24.836556 0,16 C0,7.163444 7.163444,-3.41060513e-13 16,-3.41060513e-13 Z M11.3505859,12.4641113 L7.45385744,12.4641113 L7.45385744,24.1875 L11.3505859,24.1875 L11.3505859,12.4641113 Z M20.9152832,12.1889649 C18.8479004,12.1889649 17.9213867,13.3251953 17.4035644,14.1240234 L17.4035644,14.1240234 L17.4035644,12.4641113 L13.5070801,12.4641113 C13.5212538,12.7696262 13.5275532,13.809993 13.5292593,15.1533871 L13.5293118,16.8832762 C13.5292156,16.9843911 13.5291048,17.0860852 13.5289803,17.1882303 L13.5280782,17.8054916 L13.5280782,17.8054916 L13.5268961,18.427439 C13.5216699,20.9164121 13.5108442,23.3704557 13.5078578,24.0208157 L13.5070801,24.1875 L17.4035644,24.1875 L17.4035644,17.640625 C17.4035644,17.2902832 17.4287109,16.9401856 17.5317382,16.6896972 C17.8134766,15.9897461 18.4545899,15.2646484 19.5310059,15.2646484 C20.940918,15.2646484 21.5051269,16.3395996 21.5051269,17.9157715 L21.5051269,17.9157715 L21.5051269,24.1875 L25.4013672,24.1875 L25.4013672,17.465332 C25.4013672,13.8645019 23.4790039,12.1889649 20.9152832,12.1889649 Z M9.42822263,6.8125 C8.09521488,6.8125 7.22363281,7.68774412 7.22363281,8.83813475 C7.22363281,9.96313475 8.06933594,10.8632812 9.37695313,10.8632812 L9.37695313,10.8632812 L9.40234375,10.8632812 C10.7612305,10.8632812 11.6069336,9.96313475 11.6069336,8.83813475 C11.581543,7.68774412 10.7612305,6.8125 9.42822263,6.8125 Z"
97
- />
98
- </svg>
99
- </span><a
100
- href="https://www.linkedin.com/sharing/share-offsite/?url={href}"
101
- class="ons-list__link"
102
- target="_blank">LinkedIn<span class="ons-u-vh"> (opens in a new tab)</span></a
103
- >
104
- </li>
105
- <li class="ons-list__item">
106
- <span class="ons-list__prefix" aria-hidden="true">
107
- <svg
108
- class="ons-icon ons-icon--2xl"
109
- id="icon-email"
110
- viewBox="0 0 36 36"
111
- xmlns="http://www.w3.org/2000/svg"
112
- focusable="false"
113
- aria-hidden="true"
114
- role="img"
115
- title="ons-icon-email"
116
- >
117
- <path
118
- fill-rule="evenodd"
119
- clip-rule="evenodd"
120
- d="M30.7279 5.27208C27.3523 1.89642 22.7739 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36C27.9411 36 36
114
+ </li>
115
+ {/if}
116
+ {#if platforms.includes("email")}
117
+ <li class="ons-list__item">
118
+ <span class="ons-list__prefix" aria-hidden="true">
119
+ <svg
120
+ class="ons-icon ons-icon--2xl"
121
+ id="icon-email"
122
+ viewBox="0 0 36 36"
123
+ xmlns="http://www.w3.org/2000/svg"
124
+ focusable="false"
125
+ aria-hidden="true"
126
+ role="img"
127
+ title="ons-icon-email"
128
+ >
129
+ <path
130
+ fill-rule="evenodd"
131
+ clip-rule="evenodd"
132
+ d="M30.7279 5.27208C27.3523 1.89642 22.7739 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36C27.9411 36 36
121
133
  27.9411 36 18C36 13.2261 34.1036 8.64773 30.7279 5.27208ZM18 19L26 14V12L18 17L10 12V14L18 19ZM8 10H28V26H8V10Z"
122
- ></path>
123
- </svg>
124
- </span><a
125
- href="mailto:?subject={pageTitle}&body={pageTitle}%0A{href}"
126
- class="ons-list__link"
127
- target="_blank">Email<span class="ons-u-vh"> (opens in a new tab)</span></a
128
- >
129
- </li>
134
+ ></path>
135
+ </svg>
136
+ </span><a
137
+ href="mailto:?subject={pageTitle}&body={pageTitle}%0A{href}"
138
+ class="ons-list__link"
139
+ target="_blank">Email<span class="ons-u-vh"> (opens in a new tab)</span></a
140
+ >
141
+ </li>
142
+ {/if}
130
143
  </ul>
131
144
  </Container>
@@ -6,6 +6,7 @@ export default class ShareButtons extends SvelteComponentTyped<{
6
6
  marginTop?: boolean | undefined;
7
7
  marginBottom?: boolean | undefined;
8
8
  title?: string | undefined;
9
+ platforms?: string[] | undefined;
9
10
  }, {
10
11
  [evt: string]: CustomEvent<any>;
11
12
  }, {}> {
@@ -20,6 +21,7 @@ declare const __propDef: {
20
21
  marginTop?: boolean | undefined;
21
22
  marginBottom?: boolean | undefined;
22
23
  title?: string | undefined;
24
+ platforms?: string[] | undefined;
23
25
  };
24
26
  events: {
25
27
  [evt: string]: CustomEvent<any>;