@progressive-development/pd-page 0.1.93 → 0.1.94

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
@@ -3,7 +3,7 @@
3
3
  "description": "Progressive development page helper, teaser, menu, footer.",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "PD Progressive Development",
6
- "version": "0.1.93",
6
+ "version": "0.1.94",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
package/src/PdMenu.js CHANGED
@@ -55,7 +55,7 @@ export class PdMenu extends LitElement {
55
55
  margin: 0 auto;
56
56
  }
57
57
 
58
- ul {
58
+ .menu-ul {
59
59
  display: flex;
60
60
  align-items: center;
61
61
  list-style: none;
@@ -63,14 +63,45 @@ export class PdMenu extends LitElement {
63
63
  padding: 0;
64
64
  }
65
65
 
66
- li {
66
+ .burger-ul {
67
+ visibility: hidden;
68
+ position: absolute;
69
+ flex-direction: column;
70
+ top: var(--pd-menu-burger-top, var(--pd-menu-height, 100px));
71
+ right: 0px;
72
+ background-color: var(--pd-menu-burger-bg-col, var(--pd-default-light-col));
73
+
74
+ box-shadow: var(--pd-menu-shadow, 3px 3px 5px grey);
75
+ border-bottom: var(--pd-menu-burger-bottomborder);
76
+ padding: var(--pd-menu-burger-padding, 0);
77
+ width:100%;
78
+ -moz-border-radius: var(--pd-border-radius);
79
+ border-radius: var(--pd-border-radius);
80
+ }
81
+
82
+ :host([_activeBurgerMenu]) .burger-ul {
83
+ visibility: visible;
84
+ }
85
+
86
+ .menu-li {
67
87
  display: flex;
68
88
  align-items: center;
69
89
  cursor: pointer;
70
90
  border-radius: var(--pd-border-radius);
71
-
72
91
  }
73
92
 
93
+ .burger-li {
94
+ border-radius: var(--pd-border-radius);
95
+ align-self: justify;
96
+ width:80%;
97
+ font-size:90% !important;
98
+ height:1rem;
99
+ }
100
+
101
+ .burger-li:hover {
102
+ background-color: var(--pd-default-dark-col);
103
+ }
104
+
74
105
  .item {
75
106
  color: var(--pd-menu-font-col, var(--pd-default-bg-col));
76
107
  font-family: var(--pd-menu-font-family, var(--pd-default-font-title-family));
@@ -79,6 +110,10 @@ export class PdMenu extends LitElement {
79
110
  padding: var(--pd-menu-item-padding, 0.6em);
80
111
  }
81
112
 
113
+ .burger-item {
114
+ color: var(--pd-menu-burger-font-col, var(--pd-default-dark-col));
115
+ }
116
+
82
117
  .item.active,
83
118
  .item:hover {
84
119
  color: var(--pd-default-hover-col);
@@ -100,13 +135,12 @@ export class PdMenu extends LitElement {
100
135
 
101
136
  .burger-menu {
102
137
  display: flex;
103
- width: 100%;
104
- visibility: hidden;
105
- justify-content: end;
138
+ width: 100%;
139
+ justify-content: start
106
140
  }
107
141
 
108
142
  .topItemLogo {
109
- --pd-icon-size: 1.6rem;
143
+ --pd-icon-size: 1.4rem;
110
144
  /* TODO: noch vars übernehmen
111
145
  --pd-icon-bg-col: var(--pd-menu-bg-col, var(--pd-default-col));
112
146
  --pd-icon-col: var(--pd-menu-bg-col, var(--pd-default-dark-col));
@@ -114,8 +148,8 @@ export class PdMenu extends LitElement {
114
148
  */
115
149
 
116
150
  --pd-icon-bg-col: transparent;
117
- --pd-icon-stroke-col: var(--pd-default-bg-col);
118
- --pd-icon-col: var(--pd-default-dark-col);
151
+ --pd-icon-stroke-col: var(--pd-menu-font-col, var(--pd-default-bg-col));
152
+ --pd-icon-col: var(--pd-menu-font-col, var(--pd-default-bg-col));
119
153
  pointer-events: none;
120
154
  }
121
155
 
@@ -130,82 +164,17 @@ export class PdMenu extends LitElement {
130
164
  cursor: pointer;
131
165
  }
132
166
 
133
- .locales {
134
167
 
135
- color: var(--pd-menu-font-col, var(--pd-default-bg-col));
136
- font-size: var(--pd-menu-font-size, 1em);
137
-
138
- position: absolute;
139
- top: 15px;
140
- right: 15px;
141
- }
142
-
143
- .selected-locale {
144
- color: var(--pd-default-hover-col);
168
+ .locale-selection-logo {
169
+ --pd-icon-size: 0.8rem;
170
+ --pd-icon-bg-col: transparent;
171
+ --pd-icon-stroke-col: var(--pd-menu-font-col, var(--pd-default-bg-col));;
172
+ --pd-icon-col: var(--pd-menu-font-col, var(--pd-default-bg-col));;
173
+ --pd-icon-stroke-col-active: var(--pd-menu-font-col, var(--pd-default-bg-col));;
174
+ --pd-icon-col-active: var(--pd-menu-font-col, var(--pd-default-bg-col));;
145
175
  pointer-events: none;
146
176
  }
147
-
148
- .selectable-locale:hover {
149
- color: var(--pd-default-hover-col);
150
- cursor: pointer;
151
- }
152
-
153
-
154
- @media (max-width: 1300px) {
155
- .locales {
156
- right: 25%;
157
- }
158
- }
159
-
160
-
161
- /**
162
- * Style for drop down menu on small screens.
163
- */
164
- @media (max-width: 700px) {
165
-
166
- :host([_activeBurgerMenu]) ul {
167
- visibility: visible;
168
- }
169
-
170
- .burger-menu {
171
- visibility: visible;
172
- }
173
-
174
- ul {
175
- visibility: hidden;
176
- position: absolute;
177
- flex-direction: column;
178
- top: var(--pd-menu-burger-top, var(--pd-menu-height, 100px));
179
- right: 0px;
180
- background-color: var(--pd-menu-burger-bg-col, var(--pd-default-light-col));
181
177
 
182
- box-shadow: var(--pd-menu-shadow, 3px 3px 5px grey);
183
- border-bottom: var(--pd-menu-burger-bottomborder);
184
- padding: var(--pd-menu-burger-padding, 0);
185
- width:100%;
186
- -moz-border-radius: var(--pd-border-radius);
187
- border-radius: var(--pd-border-radius);
188
- }
189
-
190
- li {
191
- border-radius: var(--pd-border-radius);
192
- align-self: justify;
193
- width:80%;
194
- font-size:90% !important;
195
- height:1rem;
196
- }
197
-
198
- .item {
199
- color: var(--pd-menu-burger-font-col, var(--pd-default-dark-col));
200
- }
201
-
202
- li:hover {
203
- background-color: var(--pd-default-dark-col);
204
- }
205
-
206
- }
207
-
208
- /* Media Query für 500 => Alles darunter mit Burger Menu */
209
178
  `];
210
179
  }
211
180
 
@@ -216,13 +185,13 @@ export class PdMenu extends LitElement {
216
185
  locales: { type: Array },
217
186
  menuItems: { type: Array },
218
187
  topMenuItems: { type: Array },
188
+ noBurgerMenu: { type: Boolean },
219
189
  // At the moment needed for scroll to pistion => Refactor possible?
220
190
  headerSize: { type: Number },
221
191
  _activeSecIndex: { type: Number },
222
192
  _smallScreen: { type: Boolean, state: true },
223
193
  _activeBurgerMenu: { type: Boolean, reflect: true },
224
-
225
-
194
+ _activeLocaleMenu: { type: Boolean, reflect: true },
226
195
  };
227
196
  }
228
197
 
@@ -230,6 +199,7 @@ export class PdMenu extends LitElement {
230
199
  super();
231
200
  this.menuItems = [];
232
201
  this.topMenuItems = [];
202
+ this.noBurgerMenu = false;
233
203
  this._activeSecIndex = 0;
234
204
  this._activeBurgerMenu = false;
235
205
  this.headerSize = 0;
@@ -266,7 +236,7 @@ export class PdMenu extends LitElement {
266
236
 
267
237
  installMediaQueryWatcher(`(max-width: 700px)`, matches => {
268
238
  if (matches) {
269
- this._smallScreen = true;
239
+ this._smallScreen = !this.noBurgerMenu;
270
240
  } else {
271
241
  this._smallScreen = false;
272
242
  }
@@ -278,30 +248,28 @@ export class PdMenu extends LitElement {
278
248
  return html`
279
249
  <div class="menu-container">
280
250
  <slot @click="${this._logoClicked}" name="slotLogo"></slot>
281
- <ul>
251
+ <ul class="menu-ul ${this._smallScreen ? "burger-ul" : ""}">
282
252
  ${this._renderItems(this._smallScreen ? [...this.menuItems, ...this.topMenuItems] : this.menuItems, true, this._smallScreen)}
283
253
  </ul>
284
254
 
285
255
  ${!this._smallScreen ? html`
286
- <ul class="topMenu">
256
+ <ul class="menu-ul topMenu">
287
257
  ${this._renderItems(this.topMenuItems, false)}
258
+
259
+ ${(this.locales && this.locales.length) > 1 ? html`
260
+ <li class="item menu-li" @click="${this._toggleLocaleSelection}">
261
+ ${this.selectedLocale}
262
+ <pd-icon class="locale-selection-logo" icon="${burgerIcon}" ?activeIcon="${!this._activeLocaleMenu}"></pd-icon>
263
+ </li>
264
+ ` : ''}
288
265
  </ul>
289
266
  ` : html`
290
- <div class="burger-menu">
291
- <pd-icon class="round" icon="${burgerIcon}" ?activeIcon="${!this._activeBurgerMenu}" @click="${this._toggleBurgerMenu}"></pd-icon>
267
+ <div class="burger-menu" @click="${this._toggleBurgerMenu}">
268
+ <pd-icon class="round" icon="${burgerIcon}" ?activeIcon="${!this._activeBurgerMenu}"></pd-icon>
269
+ <span class="item">Menu</span>
292
270
  </div>
293
271
  `}
294
272
 
295
- ${(this.locales && this.locales.length) > 1 ? html`
296
- <div class="locales">
297
- ${this.locales.map((l) => html`
298
- <span @click="${this._localeClicked}" data-key="${l}"
299
- class="${l === this.selectedLocale ? 'selected-locale' : 'selectable-locale'}">${l}</span>
300
- `)}
301
-
302
- </div>
303
- ` : ''}
304
-
305
273
  </div>
306
274
  `;
307
275
  }
@@ -311,7 +279,8 @@ export class PdMenu extends LitElement {
311
279
  ${items.map(
312
280
  (item, index) => html`
313
281
  <li
314
- class="item ${(checkActiveClass && this._activeSecIndex === index + 1) || (item.route && item.route === this.activeRoute)
282
+ class="item menu-li ${this._smallScreen ? "burger-li burger-item" : ""}
283
+ ${(checkActiveClass && this._activeSecIndex === index + 1) || (item.route && item.route === this.activeRoute)
315
284
  ? 'active'
316
285
  : ''}"
317
286
  data-key="${item.key}"
@@ -334,6 +303,10 @@ export class PdMenu extends LitElement {
334
303
  this._activeBurgerMenu = !this._activeBurgerMenu;
335
304
  }
336
305
 
306
+ _toggleLocaleSelection() {
307
+ this._activeLocaleMenu = !this._activeLocaleMenu;
308
+ }
309
+
337
310
  _localeClicked(e) {
338
311
  const keyParam = e.target.dataset.key;
339
312
  this.dispatchEvent(new CustomEvent("locale-change", {
@@ -82,7 +82,7 @@ export default {
82
82
  },
83
83
  };
84
84
 
85
- function Template({ menuItems, topMenuItems, color, logo, menuColor, locales, selectedLocale }) {
85
+ function Template({ menuItems, topMenuItems, color, logo, menuColor, locales, selectedLocale, noBurger }) {
86
86
  return html`
87
87
  <pd-menu
88
88
  style="--squi-menu-bg-color: ${menuColor || color};
@@ -90,6 +90,7 @@ function Template({ menuItems, topMenuItems, color, logo, menuColor, locales, se
90
90
  .menuItems=${menuItems}
91
91
  .topMenuItems=${topMenuItems}
92
92
  ?teaserClosed="${true}"
93
+ ?noBurgerMenu="${noBurger}"
93
94
  .locales="${locales}"
94
95
  selectedLocale="${selectedLocale}"
95
96
  @route-event="${e => {
@@ -152,3 +153,19 @@ WithTopItems.args = {
152
153
  locales: ["de", "en"],
153
154
  selectedLocale: "de",
154
155
  };
156
+
157
+ // with top items
158
+ export const WithoutBurger = Template.bind({});
159
+ WithoutBurger.args = {
160
+ menuItems: [
161
+ { name: 'Service', sec: 'secServices' },
162
+ { name: 'Over ons', sec: 'secAboutUs' },
163
+ { name: 'Contact', sec: 'secContactUs' },
164
+ ],
165
+ topMenuItems: [{ name: 'Profile', icon: 'userIcon', route: 'profile' }],
166
+ color: '#084c61',
167
+ logo: ticomiLogo,
168
+ locales: ["de", "en"],
169
+ selectedLocale: "de",
170
+ noBurger: true
171
+ };