@triptease/tt-navbar 0.0.6 → 0.0.8

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.6",
6
+ "version": "0.0.8",
7
7
  "type": "module",
8
8
  "main": "dist/src/index.js",
9
9
  "module": "dist/src/index.js",
package/src/TtNavbar.ts CHANGED
@@ -8,10 +8,10 @@ export class TtNavbar extends LitElement {
8
8
  @property({ type: Function })
9
9
  navigate: ((e: MouseEvent) => void) | undefined;
10
10
 
11
- @property({ type: String })
11
+ @property({ type: String, attribute: 'base-url' })
12
12
  baseUrl?: string;
13
13
 
14
- @property({ type: String })
14
+ @property({ type: String, attribute: 'client-key' })
15
15
  clientKey?: string;
16
16
 
17
17
  private buildUrl = (path: string): string => {
package/src/styles.ts CHANGED
@@ -1,10 +1,30 @@
1
1
  import { css } from 'lit';
2
2
 
3
3
  export const styles = css`
4
+ :host {
5
+ --nav-bar-width: 260px;
6
+
7
+ display: block;
8
+ height: 100vh;
9
+ }
10
+
11
+ * {
12
+ box-sizing: border-box;
13
+ }
14
+
4
15
  nav {
5
- max-width: 260px;
16
+ min-width: var(--nav-bar-width);
17
+ width: var(--nav-bar-width);
18
+ min-height: 100vh;
19
+ height: max-content;
6
20
  display: flex;
21
+ align-items: start;
22
+ gap: var(--space-scale-3-5);
7
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);
8
28
  }
9
29
 
10
30
  nav details div {
@@ -13,9 +33,127 @@ export const styles = css`
13
33
  }
14
34
 
15
35
  hr {
16
- background: black;
17
36
  width: 100%;
18
37
  height: 1px;
38
+ background-color: var(--color-surface-inverted-200);
19
39
  border: none;
20
40
  }
41
+
42
+ #tertiary-nav {
43
+ display: flex;
44
+ flex-direction: column;
45
+ margin-top: auto;
46
+ gap: var(--space-scale-2);
47
+ width: 100%;
48
+
49
+ .external-link {
50
+ font-size: var(--font-size-100);
51
+ line-height: var(--font-line-height-100);
52
+
53
+ .icon {
54
+ width: var(--space-scale-2);
55
+ height: var(--space-scale-2);
56
+ }
57
+ }
58
+ }
59
+
60
+ .icon {
61
+ width: var(--space-scale-3);
62
+ height: var(--space-scale-3);
63
+ display: inline;
64
+ color: var(--nav-item-color);
65
+ }
66
+
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%;
76
+ }
77
+
78
+ details {
79
+ width: 100%;
80
+ border-radius: var(--border-radius-100);
81
+
82
+ summary {
83
+ font-size: var(--font-size-100);
84
+ line-height: var(--font-line-height-100);
85
+ position: relative;
86
+ display: flex;
87
+ align-items: baseline;
88
+
89
+ &::marker {
90
+ content: '';
91
+ }
92
+ }
93
+
94
+ svg.chevron {
95
+ margin-left: auto;
96
+ margin-right: var(--space-scale-1);
97
+ width: var(--space-scale-2);
98
+ }
99
+
100
+ &[open] svg.chevron {
101
+ transform: rotate(180deg);
102
+ }
103
+
104
+ .dropdown-items {
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+ }
109
+
110
+ details > summary {
111
+ display: flex;
112
+ gap: var(--space-scale-1-5);
113
+ padding: var(--space-scale-1);
114
+ border-radius: var(--border-radius-100);
115
+ color: var(--nav-item-color);
116
+ align-items: center;
117
+
118
+ a {
119
+ color: var(--nav-item-color);
120
+ }
121
+
122
+ &:hover,
123
+ &:focus-visible {
124
+ background-color: var(--color-surface-inverted-200);
125
+ border-radius: var(--border-radius-100);
126
+ text-decoration: none;
127
+ }
128
+ }
129
+
130
+ .sub-nav-item {
131
+ padding-left: 44px;
132
+ padding-top: 10px;
133
+ padding-bottom: 10px;
134
+ color: var(--color-text-inverted-400);
135
+ font-size: var(--font-size-100);
136
+ line-height: var(--font-line-height-100);
137
+
138
+ button {
139
+ color: var(--color-text-inverted-400);
140
+ padding: 0;
141
+ }
142
+ }
143
+
144
+ .sub-nav-item:hover,
145
+ .sub-nav-item:focus-visible,
146
+ a:hover,
147
+ a:focus-visible {
148
+ background-color: var(--color-surface-inverted-200);
149
+ border-radius: var(--border-radius-100);
150
+ text-decoration: none;
151
+ color: var(--color-text-inverted-400);
152
+
153
+ .icon {
154
+ color: var(--color-text-inverted-400);
155
+ }
156
+ }
157
+
158
+
21
159
  `;
@@ -6,18 +6,14 @@ export default {
6
6
  component: 'tt-navbar',
7
7
  };
8
8
 
9
-
10
-
11
-
12
9
  const Template = () => html`
13
10
  <div>
14
- <tt-navbar clientKey="zxd47KQGAP">
11
+ <tt-navbar client-key="zxd47KQGAP">
15
12
  <div slot="clientSelector">
16
13
  <p>My Cool Client Selector</p>
17
14
  </div>
18
15
  </tt-navbar>
19
16
  </div>
20
-
21
17
  `;
22
18
 
23
19
  export const Regular = Template.bind({});
@@ -25,7 +25,7 @@ describe('TtNavbar', () => {
25
25
  });
26
26
  it('should render with the default links', async () => {
27
27
  const navbar = await fixture<TtNavbar>(
28
- `<tt-navbar clientKey=${CLIENT_KEY}></tt-navbar>`,
28
+ `<tt-navbar client-key=${CLIENT_KEY}></tt-navbar>`,
29
29
  );
30
30
  const links = navbar.shadowRoot?.querySelectorAll('a');
31
31
 
@@ -54,7 +54,7 @@ describe('TtNavbar', () => {
54
54
  it('should render platform URLs against the base URL when it is defined', async () => {
55
55
  const baseUrl = 'https://app.triptease.io';
56
56
  const navbar = await fixture<TtNavbar>(
57
- `<tt-navbar clientKey=${CLIENT_KEY} baseUrl="${baseUrl}"></tt-navbar>`,
57
+ `<tt-navbar client-key=${CLIENT_KEY} base-url="${baseUrl}"></tt-navbar>`,
58
58
  );
59
59
  const links = navbar.shadowRoot?.querySelectorAll('a');
60
60
 
@@ -75,7 +75,7 @@ describe('TtNavbar', () => {
75
75
  };
76
76
 
77
77
  const navbar = await fixture<TtNavbar>(
78
- `<tt-navbar clientKey=${CLIENT_KEY}></tt-navbar>`,
78
+ `<tt-navbar client-key=${CLIENT_KEY}></tt-navbar>`,
79
79
  );
80
80
  navbar.navigate = onNavigate;
81
81
  await navbar.updateComplete;
@@ -91,7 +91,7 @@ describe('TtNavbar', () => {
91
91
 
92
92
  it('should render the given client selector', async () => {
93
93
  const navbar = await fixture<TtNavbar>(
94
- `<tt-navbar clientKey=${CLIENT_KEY}><div slot="clientSelector"><div id="myCoolClientSelector"></div></div></tt-navbar>`,
94
+ `<tt-navbar client-key=${CLIENT_KEY}><div slot="clientSelector"><div id="myCoolClientSelector"></div></div></tt-navbar>`,
95
95
  );
96
96
 
97
97
  const clientSelector = navbar.querySelector('#myCoolClientSelector');
package/demo/index.html DELETED
@@ -1,30 +0,0 @@
1
- <!doctype html>
2
- <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
- <style>
7
- body {
8
- background: #fafafa;
9
- }
10
- </style>
11
- </head>
12
- <body>
13
- <div id="demo"></div>
14
-
15
- <script type="module">
16
- import { html, render } from 'lit';
17
- import '../dist/src/tt-navbar.js';
18
-
19
- const header = 'Hello owc World!';
20
- render(
21
- html`
22
- <tt-navbar .header=${header}>
23
- some light-dom
24
- </tt-navbar>
25
- `,
26
- document.querySelector('#demo')
27
- );
28
- </script>
29
- </body>
30
- </html>