@triptease/tt-navbar 0.0.7 → 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.7",
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
@@ -2,26 +2,273 @@ import { css } from 'lit';
2
2
 
3
3
  export const styles = css`
4
4
  :host {
5
+ --nav-bar-width: 260px;
6
+
5
7
  display: block;
6
8
  height: 100vh;
7
- max-width: 260px;
9
+ }
10
+
11
+ * {
12
+ box-sizing: border-box;
8
13
  }
9
14
 
10
15
  nav {
16
+ max-width: var(--nav-bar-width);
17
+ width: var(--nav-bar-width);
18
+ min-height: 100vh;
19
+ height: max-content;
20
+ display: flex;
21
+ align-items: start;
22
+ gap: var(--space-scale-3-5);
23
+ flex-direction: column;
24
+ background-color: var(--color-surface-inverted-100);
25
+ color: var(--color-text-inverted-400);
26
+ padding-top: var(--space-scale-2);
27
+ padding-bottom: var(--space-scale-2);
28
+ z-index: 1;
29
+
30
+ .nav-items {
31
+ display: flex;
32
+ flex-direction: column;
33
+ padding: 0 var(--space-scale-1);
34
+ width: 100%;
35
+ }
36
+
37
+ hr {
38
+ width: 100%;
39
+ height: 1px;
40
+ background-color: var(--color-surface-inverted-200);
41
+ border: none;
42
+ }
43
+
44
+ #tertiary-nav {
45
+ display: flex;
46
+ flex-direction: column;
47
+ margin-top: auto;
48
+ gap: var(--space-scale-2);
49
+ width: 100%;
50
+
51
+ .external-link {
52
+ font-size: var(--font-size-100);
53
+ line-height: var(--font-line-height-100);
54
+
55
+ .icon {
56
+ width: var(--space-scale-2);
57
+ height: var(--space-scale-2);
58
+ }
59
+ }
60
+ }
61
+
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
+ }
69
+
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
+ }
82
+ }
83
+
84
+ details {
85
+ border-radius: var(--border-radius-100);
86
+
87
+ summary {
88
+ font-size: var(--font-size-100);
89
+ line-height: var(--font-line-height-100);
90
+ position: relative;
91
+ display: flex;
92
+ align-items: baseline;
93
+
94
+ &::marker {
95
+ content: '';
96
+ }
97
+ }
98
+
99
+ .chevron > svg {
100
+ margin-left: auto;
101
+ margin-right: var(--space-scale-1);
102
+ width: var(--space-scale-2);
103
+ }
104
+
105
+ &[open] .chevron > svg {
106
+ transform: rotate(180deg);
107
+ }
108
+
109
+ .dropdown-items {
110
+ display: flex;
111
+ flex-direction: column;
112
+ }
113
+ }
114
+
115
+ details > summary {
116
+ display: flex;
117
+ gap: var(--space-scale-1-5);
118
+ padding: var(--space-scale-1);
119
+ border-radius: var(--border-radius-100);
120
+ color: var(--nav-item-color);
121
+ align-items: center;
122
+
123
+ a {
124
+ color: var(--nav-item-color);
125
+ }
126
+
127
+ &:hover,
128
+ &:focus-visible {
129
+ background-color: var(--color-surface-inverted-200);
130
+ border-radius: var(--border-radius-100);
131
+ text-decoration: none;
132
+ }
133
+ }
134
+
135
+ .sub-nav-item {
136
+ padding-left: 44px;
137
+ padding-top: 10px;
138
+ padding-bottom: 10px;
139
+ color: var(--color-text-inverted-400);
140
+ font-size: var(--font-size-100);
141
+ line-height: var(--font-line-height-100);
142
+ text-decoration: none;
143
+
144
+ button {
145
+ color: var(--color-text-inverted-400);
146
+ padding: 0;
147
+ }
148
+ }
149
+
150
+ .sub-nav-item:hover,
151
+ .sub-nav-item:focus-visible,
152
+ .nav-item:hover,
153
+ .nav-item:focus-visible {
154
+ background-color: var(--color-surface-inverted-200);
155
+ border-radius: var(--border-radius-100);
156
+ text-decoration: none;
157
+ color: var(--color-text-inverted-400);
158
+
159
+ .icon {
160
+ color: var(--color-text-inverted-400);
161
+ }
162
+ }
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 {
11
172
  display: flex;
173
+ position: absolute;
174
+ overflow: auto;
12
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));
13
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
+ }
14
190
  }
15
191
 
16
- nav details div {
192
+ .link-page > .section {
17
193
  display: flex;
18
194
  flex-direction: column;
195
+ gap: var(--space-scale-2);
19
196
  }
20
197
 
21
- hr {
22
- background: black;
23
- width: 100%;
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;
24
209
  height: 1px;
25
- border: none;
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
+ }
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;
26
273
  }
27
274
  `;