@ilo-org/twig 0.1.1 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ilo-org/twig
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a84c36d: Navigation RTL styles and design QA
8
+ - Updated dependencies [a84c36d]
9
+ - @ilo-org/icons@0.1.2
10
+ - @ilo-org/styles@0.1.2
11
+ - @ilo-org/themes@0.1.2
12
+
3
13
  ## 0.1.1
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/twig",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Twig components for the ILO's Design System",
6
6
  "main": "",
@@ -21,9 +21,9 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@ilo-org/fonts": "0.0.2",
24
- "@ilo-org/icons": "0.1.1",
25
- "@ilo-org/styles": "0.1.1",
26
- "@ilo-org/themes": "0.1.1",
24
+ "@ilo-org/icons": "0.1.2",
25
+ "@ilo-org/styles": "0.1.2",
26
+ "@ilo-org/themes": "0.1.2",
27
27
  "@ilo-org/utils": "0.0.1",
28
28
  "@wingsuit-designsystem/preset-scss": "^1.2.3",
29
29
  "video.js": "^7.19.2"
@@ -22,7 +22,7 @@ cardgroup:
22
22
  fields:
23
23
  group:
24
24
  - title: "Multi-link card - first"
25
- image: "http://placekitten.com/475/267"
25
+ image: "https://placekitten.com/475/267"
26
26
  intro: "Lorem ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas lacus."
27
27
  eyebrow: ""
28
28
  date: ""
@@ -44,7 +44,7 @@ cardgroup:
44
44
  - label: Link Three
45
45
  url: 'http://www.google.com'
46
46
  - title: "Multi-link card second - right aligned image, wide option"
47
- image: "http://placekitten.com/475/267"
47
+ image: "https://placekitten.com/475/267"
48
48
  intro: "Lorem ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas lacus."
49
49
  eyebrow: ""
50
50
  date: ""
@@ -65,7 +65,7 @@ cardgroup:
65
65
  - label: Link Three
66
66
  url: 'http://www.google.com'
67
67
  - title: "Multi-link card - right aligned image, wide option"
68
- image: "http://placekitten.com/475/267"
68
+ image: "https://placekitten.com/475/267"
69
69
  intro: "Lorem ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas ipsum dolor sit amet consectetur adipiscing elit. Lobortis egestas lacus."
70
70
  eyebrow: ""
71
71
  date: ""
@@ -93,7 +93,7 @@ cardgroup:
93
93
  fields:
94
94
  group:
95
95
  - title: "Vertical info card descriptive headline text"
96
- image: "http://placekitten.com/475/267"
96
+ image: "https://placekitten.com/475/267"
97
97
  intro: ""
98
98
  eyebrow: "Eyebrow title"
99
99
  date:
@@ -109,7 +109,7 @@ cardgroup:
109
109
  dataset: ""
110
110
  color: ""
111
111
  - title: "Vertical info card descriptive headline text"
112
- image: "http://placekitten.com/475/267"
112
+ image: "https://placekitten.com/475/267"
113
113
  intro: ""
114
114
  eyebrow: "Eyebrow title"
115
115
  date:
@@ -125,7 +125,7 @@ cardgroup:
125
125
  dataset: ""
126
126
  color: ""
127
127
  - title: "Vertical info card descriptive headline text Vertical info card descriptive headline text Vertical info card descriptive headline text"
128
- image: "http://placekitten.com/475/267"
128
+ image: "https://placekitten.com/475/267"
129
129
  intro: ""
130
130
  eyebrow: "Eyebrow title"
131
131
  date:
@@ -141,7 +141,7 @@ cardgroup:
141
141
  dataset: ""
142
142
  color: ""
143
143
  - title: "Vertical info card descriptive headline text"
144
- image: "http://placekitten.com/475/267"
144
+ image: "https://placekitten.com/475/267"
145
145
  intro: ""
146
146
  eyebrow: "Eyebrow title"
147
147
  date:
@@ -164,7 +164,7 @@ cardgroup:
164
164
  fields:
165
165
  group:
166
166
  - title: "Horizontal info card descriptive headline text"
167
- image: "http://placekitten.com/196/296"
167
+ image: "https://placekitten.com/196/296"
168
168
  intro: "This ILO flagship report details the effects of the COVID-19 crisis on the world of work. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eu auctor tusrpis, this is 200 characters."
169
169
  eyebrow: "Eyebrow title"
170
170
  date:
@@ -54,11 +54,15 @@ export default class Navigation {
54
54
  */
55
55
  this.subnavButton = this.element.querySelector(`.${this.prefix}--nav--trigger`);
56
56
  this.menuCloseSet = this.element.querySelectorAll(`.${this.prefix}--header--menu--close`);
57
- this.subnavBack = this.element.querySelector(`.${this.prefix}--mobile--subnav--back`);
57
+ this.subnavBack = this.element.querySelectorAll(`.${this.prefix}--mobile--subnav--back`);
58
58
  this.menuOpen = this.element.querySelector(`.${this.prefix}--header--menu`);
59
59
  this.searchButton = this.element.querySelector(`.${this.prefix}--search--button`);
60
60
  this.contextButton = this.element.querySelector(`.${this.prefix}--language-switcher--button`);
61
+ this.languageButton = this.element.querySelector(
62
+ `.${this.prefix}--mobile--nav--language--switcher--button`
63
+ );
61
64
  this.contextLinks = this.element.querySelectorAll(`.${this.prefix}--context-menu--link`);
65
+ this.languageLinks = this.element.querySelectorAll(`.${this.prefix}--nav--language`);
62
66
 
63
67
  return this;
64
68
  }
@@ -76,7 +80,9 @@ export default class Navigation {
76
80
  this.menuOpenClick = this.handleMenuOpenClick.bind(this);
77
81
  this.searchButtonClick = this.handleSearchButtonClick.bind(this);
78
82
  this.contextButtonClick = this.handleContextButtonClick.bind(this);
83
+ this.languageButtonClick = this.handleLanguageButtonClick.bind(this);
79
84
  this.contextLinkClick = this.handleContextLinkClick.bind(this);
85
+ this.onResize = this.handleResize.bind(this);
80
86
 
81
87
  return this;
82
88
  }
@@ -93,11 +99,15 @@ export default class Navigation {
93
99
  this.subnavButton.addEventListener(EVENTS.CLICK, () => this.subnavOpenClick());
94
100
  this.subnavButton.addEventListener(EVENTS.TOUCH_START, () => this.subnavOpenClick());
95
101
  }
102
+
96
103
  // subnavBack
97
- if (this.subnavBack) {
98
- this.subnavBack.addEventListener(EVENTS.CLICK, () => this.subnavBackClick());
99
- this.subnavBack.addEventListener(EVENTS.TOUCH_START, () => this.subnavBackClick());
104
+ if (this.subnavBack.length > 0) {
105
+ this.subnavBack.forEach((button, i) => {
106
+ button.addEventListener(EVENTS.CLICK, () => this.subnavBackClick(i));
107
+ button.addEventListener(EVENTS.TOUCH_START, () => this.subnavBackClick(i));
108
+ });
100
109
  }
110
+
101
111
  // searchButton
102
112
  if (this.searchButton) {
103
113
  this.searchButton.addEventListener(EVENTS.CLICK, () => this.searchButtonClick());
@@ -123,6 +133,12 @@ export default class Navigation {
123
133
  this.contextButton.addEventListener(EVENTS.TOUCH_START, () => this.contextButtonClick());
124
134
  }
125
135
 
136
+ // languageButton
137
+ if (this.languageButton) {
138
+ this.languageButton.addEventListener(EVENTS.CLICK, () => this.languageButtonClick());
139
+ this.languageButton.addEventListener(EVENTS.TOUCH_START, () => this.languageButtonClick());
140
+ }
141
+
126
142
  // contextLinks
127
143
  if (this.contextLinks.length > 0 && this.callback) {
128
144
  this.contextLinks.forEach((contextLink, i) => {
@@ -131,6 +147,16 @@ export default class Navigation {
131
147
  });
132
148
  }
133
149
 
150
+ // languageLinks
151
+ if (this.languageLinks.length > 0 && this.callback) {
152
+ this.languageLinks.forEach((languageLink, i) => {
153
+ languageLink.addEventListener(EVENTS.CLICK, (e) => this.contextLinkClick(e));
154
+ languageLink.addEventListener(EVENTS.TOUCH_START, (e) => this.contextLinkClick(e));
155
+ });
156
+ }
157
+
158
+ window.addEventListener(EVENTS.RESIZE, (e) => this.onResize(e));
159
+
134
160
  return this;
135
161
  }
136
162
 
@@ -147,6 +173,18 @@ export default class Navigation {
147
173
  return this;
148
174
  }
149
175
 
176
+ /**
177
+ * Onclick interaction with the language menu button
178
+ *
179
+ * @return {Object} Navigation A reference to the instance of the class
180
+ * @chainable
181
+ */
182
+ handleLanguageButtonClick() {
183
+ this.element.classList.toggle(`${this.prefix}--select--open`);
184
+
185
+ return this;
186
+ }
187
+
150
188
  /**
151
189
  * Onclick interaction with the context menu button
152
190
  *
@@ -205,6 +243,7 @@ export default class Navigation {
205
243
  */
206
244
  handleSubnavBackClick() {
207
245
  this.element.classList.remove(`${this.prefix}--subnav--open`);
246
+ this.element.classList.remove(`${this.prefix}--select--open`);
208
247
 
209
248
  return this;
210
249
  }
@@ -221,4 +260,19 @@ export default class Navigation {
221
260
 
222
261
  return this;
223
262
  }
263
+
264
+ /**
265
+ * onResize interaction with the accordion button
266
+ *
267
+ * @return {Object} Breadcrumb A reference to the instance of the class
268
+ * @chainable
269
+ */
270
+ handleResize(e) {
271
+ this.element.classList.remove(`${this.prefix}--context--open`);
272
+ this.element.classList.remove(`${this.prefix}--mobile--open`);
273
+ this.element.classList.remove(`${this.prefix}--subnav--open`);
274
+ this.element.classList.remove(`${this.prefix}--search--open`);
275
+
276
+ return this;
277
+ }
224
278
  }
@@ -37,9 +37,35 @@
37
37
  </a>
38
38
  <button class="{{prefix}}--header--menu--close">{{menucloselabel}}</button>
39
39
  </div> <!-- /.{{prefix}}--mobile--logo -->
40
- <div class="{{prefix}}--mobile--nav--search"></div> <!-- /.{{prefix}}--mobile--search -->
40
+ <div class="{{prefix}}--mobile--nav--search">
41
+ {% include '@components/searchfield/searchfield.twig' with {
42
+ input: searchfield.input,
43
+ action: searchfield.action,
44
+ prefix: prefix
45
+ }
46
+ %}
47
+ </div> <!-- /.{{prefix}}--mobile--search -->
48
+
49
+ <div class="{{prefix}}--mobile--nav--language--switcher">
50
+ <button class="{{prefix}}--mobile--nav--language--switcher--button" type="button">{{languagelabel}}</button>
51
+ </div> <!-- /.{{prefix}}--mobile--nav--language--switcher -->
52
+ <div class="{{prefix}}--mobile--nav--language--select">
53
+ <div class="{{prefix}}--header--inner">
54
+ <div class="{{prefix}}--mobile--subnav--menu">
55
+ <button class="{{prefix}}--mobile--subnav--back" type="button">{{subnav.mobilebacklabel}}</button>
56
+ <button class="{{prefix}}--header--menu--close">{{subnav.mobilecloselabel}}</button>
57
+ <h6 class="{{prefix}}--mobile--subnav--label">{{languagelabel}}</h6>
58
+ </div> <!-- /{{prefix}}--mobile--subnav--menu -->
59
+ <ul class="{{prefix}}--nav--set">
60
+ {% for item in languagecontextmenu.links %}
61
+ <li class="{{prefix}}--nav--items">
62
+ <a href="{{item.url}}" class="{{prefix}}--nav--link {{prefix}}--nav--language">{{item.label}}</a>
63
+ </li>
64
+ {% endfor %}
65
+ </ul>
66
+ </div>
67
+ </div>
41
68
 
42
- <div class="{{prefix}}--mobile--nav--language--switcher"></div> <!-- /.{{prefix}}--mobile--nav--language--switcher -->
43
69
  </div> <!-- /.{{prefix}}--mobile--nav -->
44
70
  <nav class="{{prefix}}--nav" aria-labelledby="primary-navigation">
45
71
  <h2 class="{{prefix}}--nav--label" id="primary-navigation">{{primarynav.navlabel}}</h2>