wickes-css2 2.98.0-develop.10 → 2.98.0-develop.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickes-css2",
3
- "version": "2.98.0-develop.10",
3
+ "version": "2.98.0-develop.11",
4
4
  "description": "CSS and JS and page templates in use by Wickes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,292 +1,16 @@
1
1
  var Wick = Wick || {};
2
+
2
3
  Wick.MainNav = (function () {
3
4
  return {
4
- createMainNav: function (defaultOptions) {
5
- const $mainNav = $('#main-nav');
6
-
7
- function createMainNavWrapper(data) {
8
- return `
9
- <div class="main-nav__section main-nav__section_main">
10
- <div class="main-nav__back-btn__wrap">
11
- <a href="#" class="main-nav__back-btn">
12
- <span class="icon"><i class="fas fa-arrow-left fa-lg"></i></span>
13
- </a>
14
- </div>
15
- <div class="main-nav__top-level-wrap">
16
- <ul class="main-nav__top-level">
17
- ${data.map(createMainNavTopLevel).join('')}
18
- </ul>
19
- </div>
20
- </div>
21
- `;
22
- }
23
-
24
- function createMainNavTopLevel(menuSection) {
25
- if (menuSection.name && menuSection.url) {
26
- if (menuSection.children && menuSection.children.length) {
27
- return `
28
- <li class="main-nav__top-level__item">
29
- <a href="${checkUrl(menuSection)}" class="main-nav__top-level__label ${setClass(menuSection, 1)}" tabindex="0" ${setColor(menuSection)}>
30
- ${menuSection.name}
31
- </a>
32
- <div class="main-nav__menu-wrapper">
33
- ${createMainNavBannerItem(menuSection.banner)}
34
- <ul class="main-nav__menu">
35
- ${menuSection.children.map(createMainNavItems).join('')}
36
- </ul>
37
- </div>
38
- </li>
39
- `
40
- } else {
41
- return `
42
- <li class="main-nav__top-level__item main-nav__top-level__item-last">
43
- <a href="${checkUrl(menuSection)}" class="main-nav__top-level__label" tabindex="0" ${setColor(menuSection)}>
44
- ${menuSection.name}
45
- </a>
46
- </li>
47
- `
48
- }
49
- } else {
50
- return ''
51
- }
52
- }
53
-
54
- function createMainNavBannerItem(banner) {
55
- if (banner && Wick.Responsive.getCurrentBreakpoint() !== 'up-lg') {
56
- return `
57
- <div class="main-nav__menu-banner">
58
- ${banner}
59
- </div>
60
- `;
61
- } else {
62
- return ''
63
- }
64
- }
65
-
66
- function createMainNavItems(menuSection) {
67
- if (menuSection) {
68
- if (menuSection.children && menuSection.children.length) {
69
- if(menuSection.originalChildrenCount) {
70
- console.log(menuSection)
71
- }
72
- return `
73
- <li class="main-nav__menu__item nav-col">
74
- <a href="${checkUrl(menuSection)}" class="main-nav__menu__label ${setClass(menuSection, 2)}" tabindex="0" ${setColor(menuSection)}>
75
- ${menuSection.name}
76
- </a>
77
- <div class="main-nav__sub-menu__wrapper" tabindex="0">
78
- <div class="main-nav__sub-menu">
79
- <ul>
80
- ${menuSection.children.map(createSubNavItems).join('')}
81
- ${
82
- menuSection.originalChildrenCount &&
83
- menuSection.originalChildrenCount != menuSection.children.length
84
- ? createSubNavItems({name: 'View More', class: 'main-nav__sub-menu__view-more', url: menuSection.url})
85
- : ''
86
- }
87
- </ul>
88
- <div class="main-nav__view-all">
89
- <a href="${checkUrl(menuSection)}" class="main-nav__view-all__link" tabindex="0">
90
- View all ${menuSection.name}
91
- </a>
92
- </div>
93
- ${createOffersWrapper(menuSection)}
94
- </div>
95
- </div>
96
- </li>
97
- `
98
- } else {
99
- return `
100
- <li class="main-nav__menu__item nav-col">
101
- <a href="${checkUrl(menuSection)}" class="main-nav__menu__label ${setClass(menuSection, 2)}" tabindex="0" ${setColor(menuSection)}>
102
- ${menuSection.name}
103
- </a>
104
- <div class="main-nav__sub-menu__wrapper" tabindex="0">
105
- <div class="main-nav__sub-menu">
106
- <div class="main-nav__view-all">
107
- <a href="${checkUrl(menuSection)}" class="main-nav__view-all__link" tabindex="0">
108
- View all ${menuSection.name}
109
- </a>
110
-
111
- </div>
112
- ${createOffersWrapper(menuSection)}
113
- </div>
114
- </div>
115
- </li>
116
- `
117
- }
118
- }
119
- }
120
-
121
- function createSubNavItems(subItem) {
122
- if (subItem.name && subItem.url) {
123
- return `
124
- <li class="main-nav__sub-menu__item nav-col ${subItem.class || ''}">
125
- <a href="${checkUrl(subItem)}" class="main-nav__sub-menu__link main-nav__sub-sub-menu__link-last ${setClass(subItem, 3)}" tabindex="0" ${setColor(subItem)}>
126
- ${subItem.name}
127
- </a>
128
- </li>
129
- `
130
- }
131
- }
132
-
133
- function createTopOffersWrapper(offer) {
134
- return `
135
- <div class="main-nav__top-offers">
136
- <a href="${offer.url}">
137
- <img class="main-nav__top-offers__img" src="${offer.image}" alt="${offer.name}">
138
- </a>
139
- </div>`
140
- }
141
-
142
- function createOffersWrapper(menuOffers) {
143
- if (menuOffers.offers) {
144
- let offersObj = menuOffers.offers;
145
- return `
146
- <div class="main-nav__offers__wrapper">
147
- <a href="#" class="main-nav__offers__label" tabindex="0">
148
- ${offersObj.name}
149
- </a>
150
- <div class="main-nav__offers">
151
- <div class="main-nav__offers__title">
152
- ${offersObj.name}
153
- </div>
154
- ${offersObj.offers.map(createOfferItem).join('')}
155
- </div>
156
- </div>
157
- `
158
- } else {
159
- return ''
160
- }
161
- }
162
-
163
- function createOfferItem(offer) {
164
- if (offer.image) {
165
- return `
166
- <div class="main-nav__offers__img">
167
- <a href="${offer.url}">
168
- <img src="${offer.image}" alt="${offer.name}">
169
- </a>
170
- </div>
171
- `
172
- } else if (offer.name) {
173
- return `
174
- <div class="main-nav__offers__item">
175
- <a href="${offer.url}" class="main-nav__offers__item-link" tabindex="0">
176
- ${offer.name}
177
- </a>
178
- </div>
179
- `
180
- }
181
- }
182
-
183
- function setClass(section, category) {
184
- let colorClass = '';
185
-
186
- if (section.color) {
187
- switch(section.color.toUpperCase()) {
188
- case 'GREEN':
189
- colorClass = 'green'
190
- break;
191
- case 'RED':
192
- colorClass = 'red'
193
- break;
194
- }
195
-
196
- switch(category) {
197
- case 1:
198
- colorClass += ' main-nav__top-level__label--invert'
199
- break;
200
- case 2:
201
- colorClass += ' main-nav__menu__label--invert'
202
- break;
203
- case 3:
204
- colorClass += ' main-nav__sub-menu__link--invert'
205
- break;
206
- }
207
- }
208
-
209
- return colorClass
210
- }
211
-
212
- function setColor(section) {
213
- let style = 'style="';
214
-
215
- if(section.color) {
216
- switch(section.color.toUpperCase()) {
217
- case 'GREEN':
218
- style += `background-color: #9acd32; color: #fff;`
219
- break;
220
- case 'RED':
221
- style += `background-color: #cf000f; color: #fff;`
222
- break;
223
- }
224
- }
225
-
226
- if (section.bold) {
227
- style += 'font-weight: 700;';
228
- }
229
-
230
- return style+'"'
231
- }
232
-
233
- function checkUrl(menuItem) {
234
- return menuItem.url || ''
235
- }
236
-
237
- function appendMainNav(data) {
238
- $mainNav.prepend(createMainNavWrapper(data));
239
- }
240
-
241
- const createMenu = (data) => {
242
- appendMainNav(data[0].children);
243
- Wick.Nav();
244
- Wick.Responsive.callBr();
245
- };
246
-
247
- const checkIfRealEnvironment = () => {
248
- if (defaultOptions.local) {
249
- createMenu(defaultOptions.mockData)
250
- } else {
251
- APICall(defaultOptions, createMenu)
252
- }
253
- };
254
-
255
- function APICall(options, onSuccess) {
256
- $.ajax({
257
- type: options.type,
258
- dataType: "json",
259
- url: `${options.link}/menu/main`,
260
- cache: options.cache,
261
- success: onSuccess,
262
- });
263
- }
264
-
265
- function isSSR() {
266
- return $mainNav.attr('data-ssr') === 'true'
267
- }
268
-
269
- if (isSSR()) {
270
- Wick.Nav();
271
- Wick.Responsive.callBr();
272
- } else {
273
- checkIfRealEnvironment();
274
- }
5
+ createMainNav: function () {
6
+ Wick.Nav();
7
+ Wick.Responsive.callBr();
275
8
  }
276
9
  }
277
10
  })();
278
11
 
279
12
  $(document).ready(function () {
280
- const defaultOptions = {
281
- type: 'GET',
282
- cache: true,
283
- link: window.location.origin,
284
- local: false
285
- };
286
-
287
- if (!$('#main-nav').length) {
288
- return;
289
- }
13
+ if (!$('#main-nav').length) return;
290
14
 
291
- Wick.MainNav.createMainNav(defaultOptions);
15
+ Wick.MainNav.createMainNav();
292
16
  });
@@ -1,6 +1,5 @@
1
1
  <a id="skip-to-navigation"></a>
2
2
  <nav class="main-nav" id="main-nav">
3
- {{>skeleton-nav}}
4
3
 
5
4
  {{#if isLoggedIn}}
6
5
  <div class="nav-button-wrap" data-logged-in="true">
@@ -5,33 +5,6 @@
5
5
  font-weight: 500;
6
6
  background: $white;
7
7
 
8
- .ssc {
9
- &-nav {
10
- @include make-container;
11
- @include make-container-max-widths;
12
- display: flex;
13
- gap: 5px;
14
- padding: 3px 15px;
15
- }
16
-
17
- &-line {
18
- height: 63px;
19
- border-radius: 10px;
20
-
21
- &:first-child {
22
- flex: 0 0 34px;
23
- }
24
-
25
- &:last-child {
26
- flex: 0 0 50px;
27
- }
28
- }
29
- }
30
-
31
- &__section + .ssc-nav {
32
- display: none;
33
- }
34
-
35
8
  &__top-offers {
36
9
  display: none;
37
10
  }
@@ -354,10 +327,6 @@
354
327
  }
355
328
  }
356
329
 
357
- .ssc-nav {
358
- display: none;
359
- }
360
-
361
330
  &.js-visible {
362
331
  display: block;
363
332
  }
package/src/sitemap.html CHANGED
@@ -946,17 +946,6 @@
946
946
  </a>
947
947
  </li>
948
948
  </ul>
949
- <h3>
950
- Old Navigation
951
- </h3>
952
- <ul>
953
- <li>
954
- <span class="page-id">1</span>
955
- <a href="page_old-navigation.html" target="_blank">
956
- Page with old navigation
957
- </a>
958
- </li>
959
- </ul>
960
949
 
961
950
 
962
951
  </div>
@@ -1,21 +0,0 @@
1
- var Wick = Wick || {};
2
-
3
- Wick.MainNavLocal = function(){
4
- function init() {
5
- var localOptions = {
6
- local: true,
7
- mockData: Wick.MainNavData.returnData()
8
- };
9
-
10
- if (!$('#main-nav').length || !$('.ssc-nav').length) {
11
- return;
12
- }
13
-
14
-
15
- setTimeout(()=> {
16
- Wick.MainNav.createMainNav(localOptions);
17
- }, 2000)
18
- }
19
-
20
- init()
21
- }();
@@ -1,10 +0,0 @@
1
- {{#extend "base" pageClass="" title="Old navigation" oldNav=true hideBreadcrumbs=true pageBasket=true}}
2
- {{#content "body"}}
3
- <main>
4
- <div class="container">
5
- <h1 class="page-header__title">That example old navigation</h1>
6
- <p class="page-header__intro">Must be skeleton and after loading navigation</p>
7
- </div>
8
- </main>
9
- {{/content}}
10
- {{/extend}}