@triptease/tt-navbar 0.0.8 → 0.0.9

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": "Webcomponent tt-navbar following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "tt-navbar",
6
- "version": "0.0.8",
6
+ "version": "0.0.9",
7
7
  "type": "module",
8
8
  "main": "dist/src/index.js",
9
9
  "module": "dist/src/index.js",
@@ -27,6 +27,7 @@
27
27
  "storybook:build": "tsc && npm run analyze -- --exclude dist && storybook build"
28
28
  },
29
29
  "dependencies": {
30
+ "@triptease/icons": "^1.1.1",
30
31
  "lit": "^3.1.4"
31
32
  },
32
33
  "devDependencies": {
package/src/TtNavbar.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
+ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
4
+ import { campaigns, channels, chevronDown, gear, graph, home, user, wallet } from '@triptease/icons';
3
5
  import { styles } from './styles.js';
4
6
 
5
7
  export class TtNavbar extends LitElement {
@@ -32,80 +34,120 @@ export class TtNavbar extends LitElement {
32
34
  render() {
33
35
  return html`
34
36
  <nav id=${this.id}>
35
- <a href=${this.buildUrl('/')} @click=${this.onAnchorClick}>Dashboard</a>
36
- <a href="https://app.campaign-manager.triptease.io">Campaigns</a>
37
- <a href=${this.buildUrl('/channels')} @click=${this.onAnchorClick}
38
- >Channels</a
39
- >
40
- <details>
41
- <summary>Market Insights</summary>
42
- <div>
43
- <a
44
- href=${this.buildUrl('/parity/$CLIENT_KEY')}
45
- @click=${this.onAnchorClick}
37
+ <div class="nav-items">
38
+ <a
39
+ class="nav-item"
40
+ href=${this.buildUrl('/')}
41
+ @click=${this.onAnchorClick}
42
+ >${unsafeSVG(home)}Dashboard</a
43
+ >
44
+ <a class="nav-item" href="https://app.campaign-manager.triptease.io"
45
+ >${unsafeSVG(campaigns)}Campaigns</a
46
+ >
47
+ <a
48
+ class="nav-item"
49
+ href=${this.buildUrl('/channels')}
50
+ @click=${this.onAnchorClick}
51
+ >${unsafeSVG(channels)}Channels</a
52
+ >
53
+ <details>
54
+ <summary>
55
+ ${unsafeSVG(graph)}
56
+ <span>Market Insights</span>
57
+ <span class="icon chevron"> ${unsafeSVG(chevronDown)}</span>
58
+ </summary>
59
+ <div class="dropdown-items">
60
+ <a
61
+ class="sub-nav-item"
62
+ href=${this.buildUrl('/parity/$CLIENT_KEY')}
63
+ @click=${this.onAnchorClick}
46
64
  >Parity</a
47
- >
48
- <a
49
- href=${this.buildUrl('/guest-insights/$CLIENT_KEY')}
50
- @click=${this.onAnchorClick}
65
+ >
66
+ <a
67
+ class="sub-nav-item"
68
+ href=${this.buildUrl('/guest-insights/$CLIENT_KEY')}
69
+ @click=${this.onAnchorClick}
51
70
  >Guest insights</a
52
- >
53
- </div>
54
- </details>
55
- <details>
56
- <summary>Settings</summary>
57
- <div>
58
- <a
59
- href=${this.buildUrl('/$CLIENT_KEY/guest-behavioural-data')}
60
- @click=${this.onAnchorClick}
71
+ >
72
+ </div>
73
+ </details>
74
+ <details>
75
+ <summary>
76
+ ${unsafeSVG(gear)}
77
+ <span>Settings</span>
78
+ <span class="icon chevron"> ${unsafeSVG(chevronDown)}</span>
79
+ </summary>
80
+ <div class="dropdown-items">
81
+ <a
82
+ class="sub-nav-item"
83
+ href=${this.buildUrl('/$CLIENT_KEY/guest-behavioural-data')}
84
+ @click=${this.onAnchorClick}
61
85
  >Email setup</a
62
- >
63
- <a
64
- href=${this.buildUrl('/$CLIENT_KEY/crm-config')}
65
- @click=${this.onAnchorClick}
86
+ >
87
+ <a
88
+ class="sub-nav-item"
89
+ href=${this.buildUrl('/$CLIENT_KEY/crm-config')}
90
+ @click=${this.onAnchorClick}
66
91
  >CRM connectivity</a
67
- >
68
- <a
69
- href=${this.buildUrl('/settings/group')}
70
- @click=${this.onAnchorClick}
92
+ >
93
+ <a
94
+ class="sub-nav-item"
95
+ href=${this.buildUrl('/settings/group')}
96
+ @click=${this.onAnchorClick}
71
97
  >Group settings</a
72
- >
73
- <a
74
- href=${this.buildUrl('/settings/$CLIENT_KEY/hotels/')}
75
- @click=${this.onAnchorClick}
98
+ >
99
+ <a
100
+ class="sub-nav-item"
101
+ href=${this.buildUrl('/settings/$CLIENT_KEY/hotels/')}
102
+ @click=${this.onAnchorClick}
76
103
  >Property settings</a
77
- >
78
- </div>
79
- </details>
80
- <hr />
81
- <details>
82
- <summary>Account</summary>
83
- <div>
84
- <a href=${this.buildUrl('/account')} @click=${this.onAnchorClick}
104
+ >
105
+ </div>
106
+ </details>
107
+ <hr />
108
+ <details>
109
+ <summary>
110
+ ${unsafeSVG(user)}
111
+ <span>Account</span>
112
+ <span class="icon chevron"> ${unsafeSVG(chevronDown)}</span>
113
+ </summary>
114
+ <div class="dropdown-items">
115
+ <a
116
+ class="sub-nav-item"
117
+ href=${this.buildUrl('/account')}
118
+ @click=${this.onAnchorClick}
85
119
  >User settings</a
86
- >
87
- <a
88
- href=${this.buildUrl('/account/team/$CLIENT_KEY')}
89
- @click=${this.onAnchorClick}
120
+ >
121
+ <a
122
+ class="sub-nav-item"
123
+ href=${this.buildUrl('/account/team/$CLIENT_KEY')}
124
+ @click=${this.onAnchorClick}
90
125
  >Team and permissions</a
91
- >
92
- </div>
93
- </details>
94
- <details>
95
- <summary>Billing</summary>
96
- <div>
97
- <a
98
- href=${this.buildUrl('/account/billing-management/$CLIENT_KEY')}
99
- @click=${this.onAnchorClick}
126
+ >
127
+ </div>
128
+ </details>
129
+ <details class="dropdown-items">
130
+ <summary>
131
+ ${unsafeSVG(wallet)}
132
+ <span>Billing</span>
133
+ <span class="icon chevron"> ${unsafeSVG(chevronDown)}</span>
134
+ </summary>
135
+ <div>
136
+ <a
137
+ class="sub-nav-item"
138
+ href=${this.buildUrl('/account/billing-management/$CLIENT_KEY')}
139
+ @click=${this.onAnchorClick}
100
140
  >Booking reconciliation</a
101
- >
102
- <a
103
- href=${this.buildUrl('/subscriptions/$CLIENT_KEY')}
104
- @click=${this.onAnchorClick}
141
+ >
142
+ <a
143
+ class="sub-nav-item"
144
+ href=${this.buildUrl('/subscriptions/$CLIENT_KEY')}
145
+ @click=${this.onAnchorClick}
105
146
  >Subscriptions</a
106
- >
107
- </div>
108
- </details>
147
+ >
148
+ </div>
149
+ </details>
150
+ </div>
109
151
  <slot name="clientSelector"></slot>
110
152
  </nav>
111
153
  `;
package/src/styles.ts CHANGED
@@ -13,7 +13,7 @@ export const styles = css`
13
13
  }
14
14
 
15
15
  nav {
16
- min-width: var(--nav-bar-width);
16
+ max-width: var(--nav-bar-width);
17
17
  width: var(--nav-bar-width);
18
18
  min-height: 100vh;
19
19
  height: max-content;
@@ -25,58 +25,63 @@ export const styles = css`
25
25
  color: var(--color-text-inverted-400);
26
26
  padding-top: var(--space-scale-2);
27
27
  padding-bottom: var(--space-scale-2);
28
- }
28
+ z-index: 1;
29
29
 
30
- nav details div {
31
- display: flex;
32
- flex-direction: column;
33
- }
30
+ .nav-items {
31
+ display: flex;
32
+ flex-direction: column;
33
+ padding: 0 var(--space-scale-1);
34
+ width: 100%;
35
+ }
34
36
 
35
- hr {
36
- width: 100%;
37
- height: 1px;
38
- background-color: var(--color-surface-inverted-200);
39
- border: none;
40
- }
37
+ hr {
38
+ width: 100%;
39
+ height: 1px;
40
+ background-color: var(--color-surface-inverted-200);
41
+ border: none;
42
+ }
41
43
 
42
- #tertiary-nav {
43
- display: flex;
44
- flex-direction: column;
45
- margin-top: auto;
46
- gap: var(--space-scale-2);
47
- width: 100%;
44
+ #tertiary-nav {
45
+ display: flex;
46
+ flex-direction: column;
47
+ margin-top: auto;
48
+ gap: var(--space-scale-2);
49
+ width: 100%;
48
50
 
49
- .external-link {
50
- font-size: var(--font-size-100);
51
- line-height: var(--font-line-height-100);
51
+ .external-link {
52
+ font-size: var(--font-size-100);
53
+ line-height: var(--font-line-height-100);
52
54
 
53
- .icon {
54
- width: var(--space-scale-2);
55
- height: var(--space-scale-2);
55
+ .icon {
56
+ width: var(--space-scale-2);
57
+ height: var(--space-scale-2);
58
+ }
56
59
  }
57
60
  }
58
- }
59
61
 
60
- .icon {
61
- width: var(--space-scale-3);
62
- height: var(--space-scale-3);
63
- display: inline;
64
- color: var(--nav-item-color);
65
- }
62
+ .icon {
63
+ display: flex;
64
+ align-items: center;
65
+ width: var(--space-scale-3);
66
+ height: var(--space-scale-3);
67
+ color: var(--nav-item-color);
68
+ }
66
69
 
67
- a {
68
- font-size: var(--font-size-100);
69
- line-height: var(--font-line-height-100);
70
- gap: var(--space-scale-1-5);
71
- border-radius: var(--border-radius-100);
72
- color: var(--nav-item-color);
73
- text-decoration: none;
74
- padding: var(--space-scale-1);
75
- width: 100%;
70
+ .nav-item {
71
+ display: flex;
72
+ font-size: var(--font-size-100);
73
+ line-height: var(--font-line-height-100);
74
+ gap: var(--space-scale-1-5);
75
+ border-radius: var(--border-radius-100);
76
+ color: var(--nav-item-color);
77
+ align-items: center;
78
+ padding: var(--space-scale-1);
79
+ width: 100%;
80
+ text-decoration: none;
81
+ }
76
82
  }
77
83
 
78
84
  details {
79
- width: 100%;
80
85
  border-radius: var(--border-radius-100);
81
86
 
82
87
  summary {
@@ -91,13 +96,13 @@ export const styles = css`
91
96
  }
92
97
  }
93
98
 
94
- svg.chevron {
99
+ .chevron > svg {
95
100
  margin-left: auto;
96
101
  margin-right: var(--space-scale-1);
97
102
  width: var(--space-scale-2);
98
103
  }
99
104
 
100
- &[open] svg.chevron {
105
+ &[open] .chevron > svg {
101
106
  transform: rotate(180deg);
102
107
  }
103
108
 
@@ -134,6 +139,7 @@ export const styles = css`
134
139
  color: var(--color-text-inverted-400);
135
140
  font-size: var(--font-size-100);
136
141
  line-height: var(--font-line-height-100);
142
+ text-decoration: none;
137
143
 
138
144
  button {
139
145
  color: var(--color-text-inverted-400);
@@ -143,8 +149,8 @@ export const styles = css`
143
149
 
144
150
  .sub-nav-item:hover,
145
151
  .sub-nav-item:focus-visible,
146
- a:hover,
147
- a:focus-visible {
152
+ .nav-item:hover,
153
+ .nav-item:focus-visible {
148
154
  background-color: var(--color-surface-inverted-200);
149
155
  border-radius: var(--border-radius-100);
150
156
  text-decoration: none;
@@ -155,5 +161,114 @@ export const styles = css`
155
161
  }
156
162
  }
157
163
 
164
+ .current-page {
165
+ --nav-item-color: var(--color-primary-400);
166
+ border-radius: var(--border-radius-100);
167
+ background-color: var(--color-primary-100);
168
+ color: var(--nav-item-color);
169
+ }
170
+
171
+ .link-page {
172
+ display: flex;
173
+ position: absolute;
174
+ overflow: auto;
175
+ flex-direction: column;
176
+ gap: var(--space-scale-4);
177
+ padding: var(--space-scale-5);
178
+ left: var(--nav-bar-width);
179
+ background-color: var(--color-surface-200);
180
+ width: calc(100% - var(--nav-bar-width));
181
+ height: 100%;
182
+ transition-property: left, visibility;
183
+ transition-duration: 700ms, 400ms;
184
+ transition-timing-function: ease-out, ease-in;
185
+
186
+ &.hidden {
187
+ left: -100%;
188
+ visibility: hidden;
189
+ }
190
+ }
191
+
192
+ .link-page > .section {
193
+ display: flex;
194
+ flex-direction: column;
195
+ gap: var(--space-scale-2);
196
+ }
197
+
198
+ .section > .links-container {
199
+ display: grid;
200
+ grid-template-columns: repeat(3, 1fr);
201
+ gap: var(--space-scale-3);
202
+ overflow-y: auto;
203
+ height: 100%;
204
+ }
205
+
206
+ .visually-hidden {
207
+ position: absolute;
208
+ width: 1px;
209
+ height: 1px;
210
+ margin: -1px;
211
+ padding: 0;
212
+ border: 0;
213
+ overflow: hidden;
214
+ clip: rect(0 0 0 0);
215
+ clip-path: inset(50%);
216
+ white-space: nowrap;
217
+ }
218
+
219
+ .tooltip {
220
+ position: absolute;
221
+ display: flex;
222
+ white-space: nowrap;
223
+ align-items: center;
224
+ gap: var(--space-scale-1);
225
+ color: black;
226
+ background-color: var(--color-surface-600);
227
+ padding: var(--space-scale-1);
228
+ z-index: 1000;
229
+ border-radius: var(--border-radius-50);
230
+ font-weight: var(--font-weight-medium);
231
+ }
232
+
233
+ .auth-container {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: center;
237
+ min-height: 100vh;
238
+ }
239
+
240
+ .error-container {
241
+ padding: 4rem 1rem 1rem;
242
+ max-width: 1280px;
243
+ margin-left: auto;
244
+ margin-right: auto;
245
+ }
246
+
247
+ .error-stack {
248
+ width: 100%;
249
+ padding: 1rem;
250
+ overflow-x: auto;
251
+ }
252
+
253
+ .fullscreen-iframe {
254
+ width: 100%;
255
+ height: 100vh;
256
+ border: 0;
257
+ }
158
258
 
259
+ .nav-toggle-button {
260
+ position: relative;
261
+ }
262
+
263
+ .nav-toggle-tooltip {
264
+ left: 100%;
265
+ top: 100%;
266
+ visibility: hidden;
267
+ opacity: 0;
268
+ }
269
+
270
+ .nav-toggle-button:hover .nav-toggle-tooltip {
271
+ visibility: visible;
272
+ opacity: 1;
273
+ }
159
274
  `;