@hotosm/ui 0.2.0-b2 → 0.2.0-b4
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/README.md +32 -24
- package/components/header/header.d.ts +30 -0
- package/components/header/header.js +237 -0
- package/components/header/header.ts +237 -0
- package/components/icons.js +6 -0
- package/components/icons.ts +84 -0
- package/components/index.d.ts +127 -4
- package/components/index.js +125 -4
- package/components/index.ts +259 -0
- package/components/{Toolbar.d.ts → toolbar/toolbar.d.ts} +1 -3
- package/components/{Toolbar.js → toolbar/toolbar.js} +10 -12
- package/components/toolbar/toolbar.ts +128 -0
- package/components/{Tracking.d.ts → tracking/tracking.d.ts} +1 -3
- package/components/{Tracking.js → tracking/tracking.js} +8 -12
- package/components/tracking/tracking.ts +173 -0
- package/dist/components.js +18122 -51
- package/dist/style.css +1 -0
- package/package.json +6 -13
- package/react/Header.js +4 -1
- package/react/Toolbar.js +9 -9
- package/react/Tracking.js +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.js +0 -1
- package/theme/sl-custom.css +74 -0
- package/components/Button.d.ts +0 -16
- package/components/Button.js +0 -75
- package/components/Header.d.ts +0 -16
- package/components/Header.js +0 -152
- package/dist/assets/logo-CqlPtOQW.png +0 -0
- package/dist/styles.css +0 -1092
- package/react/Button.d.ts +0 -2
- package/react/Button.js +0 -14
package/README.md
CHANGED
|
@@ -45,6 +45,9 @@ The components are
|
|
|
45
45
|
[Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components),
|
|
46
46
|
currently written in **Lit**, using TypeScript.
|
|
47
47
|
|
|
48
|
+
Compositie components (header, sidebar, etc) are generated using Shoelace, with
|
|
49
|
+
the remaining low-level components exported from the Shoelace library too.
|
|
50
|
+
|
|
48
51
|
## Install
|
|
49
52
|
|
|
50
53
|
There are two options for install:
|
|
@@ -64,22 +67,30 @@ There are two options for install:
|
|
|
64
67
|
|
|
65
68
|
```html
|
|
66
69
|
<script>
|
|
70
|
+
import '@hotosm/ui/dist/style.css';
|
|
67
71
|
import '@hotosm/ui/dist/components.js';
|
|
68
72
|
</script>
|
|
69
73
|
|
|
70
74
|
// Use the components in your templates
|
|
71
|
-
<hot-
|
|
75
|
+
<hot-header @login="someFunction()"> </hot-header>
|
|
72
76
|
```
|
|
73
77
|
|
|
74
78
|
#### Via CDN
|
|
75
79
|
|
|
76
80
|
```html
|
|
81
|
+
// Import the styles (or create your own)
|
|
82
|
+
<link
|
|
83
|
+
rel="stylesheet"
|
|
84
|
+
href="https://s3.amazonaws.com/hotosm-ui/latest/style.css"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
// Import the components
|
|
77
88
|
<script
|
|
78
89
|
type="module"
|
|
79
90
|
src="https://cdn.jsdelivr.net/npm/@hotosm/ui@latest/dist/components.js"
|
|
80
91
|
></script>
|
|
81
92
|
|
|
82
|
-
<hot-
|
|
93
|
+
<hot-header @login="someFunction()> </hot-header>
|
|
83
94
|
```
|
|
84
95
|
|
|
85
96
|
The `jsdelivr` CDN only includes package releases, with `@latest` pointing to the
|
|
@@ -94,28 +105,24 @@ There is also an S3-based CDN, where `latest` tracks the `main` branch of the re
|
|
|
94
105
|
'tree-shaking' can remove the remaining ones you don't use.
|
|
95
106
|
- If you are developing an application that uses `@hotosm/ui` components,
|
|
96
107
|
including a bundler such as rollup/vite/webpack, this is probably the best approach.
|
|
97
|
-
- However, you must first add
|
|
108
|
+
- However, you must first add Lit as a `peerDependency` in your `package.json`:
|
|
98
109
|
|
|
99
110
|
```json
|
|
100
111
|
"peerDependencies": {
|
|
101
|
-
"
|
|
112
|
+
"lit": "^3.1.0"
|
|
102
113
|
}
|
|
103
114
|
```
|
|
104
115
|
|
|
105
|
-
> Ideally the version of
|
|
116
|
+
> Ideally the version of Lit installed should match the version used in
|
|
106
117
|
> hotosm/ui.
|
|
107
118
|
|
|
108
|
-
- This will also install subdependencies such as Lit.
|
|
109
|
-
- If there is a conflict between Lit versions, the `lit` package can also be pinned
|
|
110
|
-
via `peerDependency`.
|
|
111
|
-
|
|
112
119
|
Example:
|
|
113
120
|
|
|
114
121
|
```js
|
|
115
|
-
import '@hotosm/ui/components/
|
|
122
|
+
import '@hotosm/ui/components/header/header';
|
|
116
123
|
|
|
117
124
|
// Then in your template
|
|
118
|
-
<hot-
|
|
125
|
+
<hot-header @login="${someFunction()}"></hot-header>
|
|
119
126
|
```
|
|
120
127
|
|
|
121
128
|
### React
|
|
@@ -130,7 +137,7 @@ pnpm install @hotosm/ui
|
|
|
130
137
|
```
|
|
131
138
|
|
|
132
139
|
```js
|
|
133
|
-
import { Button } from '@hotosm/ui/react/
|
|
140
|
+
import { Button } from '@hotosm/ui/react/Header'
|
|
134
141
|
|
|
135
142
|
const HomePage = ({}) => {
|
|
136
143
|
return (
|
|
@@ -138,7 +145,7 @@ const HomePage = ({}) => {
|
|
|
138
145
|
<div
|
|
139
146
|
...
|
|
140
147
|
>
|
|
141
|
-
<
|
|
148
|
+
<Header @onLogin="${someFunction()}" />
|
|
142
149
|
</div>
|
|
143
150
|
</div>
|
|
144
151
|
);
|
|
@@ -152,20 +159,21 @@ export default HomePage;
|
|
|
152
159
|
|
|
153
160
|
## Using Extra Shoelace Components
|
|
154
161
|
|
|
155
|
-
The UI library
|
|
156
|
-
|
|
162
|
+
The UI library contains many composite components, such as headers, sidebars,
|
|
163
|
+
tracking banners, etc, and does not re-invent the wheel for low-level components.
|
|
157
164
|
|
|
158
|
-
|
|
159
|
-
library (particularly if using the ES Modules)
|
|
165
|
+
Shoelace is an excellent UI library that is exported directly from `@hotosm/ui`.
|
|
160
166
|
|
|
161
|
-
To
|
|
167
|
+
To access the low-level components, such as buttons, dropdowns, modals, etc,
|
|
168
|
+
simply import the component of the same name from the [Shoelace docs]
|
|
169
|
+
(<https://shoelace.style>):
|
|
162
170
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
|
|
171
|
+
```js
|
|
172
|
+
import '@hotosm/ui/components/button/button';
|
|
173
|
+
|
|
174
|
+
// Then in your template
|
|
175
|
+
<hot-button disabled variant="secondary">Can't Click Me</hot-button>
|
|
176
|
+
```
|
|
169
177
|
|
|
170
178
|
If you are using a bundler, you must bundle the (icon) assets yourself,
|
|
171
179
|
described in the Shoelace docs.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "../../theme/sl-custom.css";
|
|
2
|
+
import '@shoelace-style/shoelace/dist/components/icon-button/icon-button.js';
|
|
3
|
+
import '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
|
4
|
+
import '@shoelace-style/shoelace/dist/components/tab-group/tab-group.js';
|
|
5
|
+
import '@shoelace-style/shoelace/dist/components/tab/tab.js';
|
|
6
|
+
import { LitElement } from "lit";
|
|
7
|
+
type sizes = "small" | "large";
|
|
8
|
+
interface MenuItem {
|
|
9
|
+
label: string;
|
|
10
|
+
clickEvent: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class Header extends LitElement {
|
|
13
|
+
name: string;
|
|
14
|
+
/** Use a text-based title in the header. */
|
|
15
|
+
title: string;
|
|
16
|
+
/** Display a logo on the left of the header. */
|
|
17
|
+
logo: string | URL;
|
|
18
|
+
/** Add a drawer icon with a click event to e.g. open a sidebar. */
|
|
19
|
+
drawer: boolean;
|
|
20
|
+
/** Array of menu items to include as navigation tabs. */
|
|
21
|
+
tabs: MenuItem[];
|
|
22
|
+
/** Size of toolbar vertically. */
|
|
23
|
+
size: sizes;
|
|
24
|
+
private selectedTab;
|
|
25
|
+
static styles: import("lit").CSSResult[];
|
|
26
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
27
|
+
private _selectTab;
|
|
28
|
+
private _handleLogin;
|
|
29
|
+
}
|
|
30
|
+
export default Header;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import "../../theme/sl-custom.css";
|
|
8
|
+
import '@shoelace-style/shoelace/dist/components/icon-button/icon-button.js';
|
|
9
|
+
import '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
|
10
|
+
import '@shoelace-style/shoelace/dist/components/tab-group/tab-group.js';
|
|
11
|
+
import '@shoelace-style/shoelace/dist/components/tab/tab.js';
|
|
12
|
+
import { LitElement, css, html } from "lit";
|
|
13
|
+
import { property, state } from "lit/decorators.js";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import registerBundledIcons from '../../components/icons';
|
|
16
|
+
registerBundledIcons();
|
|
17
|
+
const headerVariants = cva(
|
|
18
|
+
// Defaults to include in all variants
|
|
19
|
+
`
|
|
20
|
+
flex flex-row bg-[var(--hot-white)] items-center justify-between
|
|
21
|
+
sm:justify-around p-2 border-b-2 border-b-gray-100 border-b-solid
|
|
22
|
+
`, {
|
|
23
|
+
variants: {
|
|
24
|
+
size: {
|
|
25
|
+
small: "h-8",
|
|
26
|
+
large: "h-14",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export class Header extends LitElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.name = "hot-header";
|
|
34
|
+
/** Use a text-based title in the header. */
|
|
35
|
+
this.title = '';
|
|
36
|
+
/** Display a logo on the left of the header. */
|
|
37
|
+
this.logo = `
|
|
38
|
+
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAB9CAMAAAAvBq6hAAAAbFBMVEX
|
|
39
|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g7feTpcmWMtuwOo41kpUIy2CfI0MbIo/ZLyBLWxNOWMTqONbUdaDwWU9Hp
|
|
101
|
+
/jT+vt1lvYn3K2132Y2o4IDP2qnx9nwu2tFeOrAG03QKaVDLvx3o8SvqHwVrFcfFrzEylXJZLlTkI
|
|
102
|
+
vXoeoy+OGO3EF/XueH175WssAF1D/EZR1ZoXdfTTr14SB+I8iNj+UNaPNOhmZ7pPotj9bQrrcUj1R
|
|
103
|
+
QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ+Gf4H5j7yuOYiAtqAAAAAElFTkSuQmCC
|
|
104
|
+
`;
|
|
105
|
+
/** Add a drawer icon with a click event to e.g. open a sidebar. */
|
|
106
|
+
this.drawer = true;
|
|
107
|
+
/** Array of menu items to include as navigation tabs. */
|
|
108
|
+
this.tabs = [];
|
|
109
|
+
/** Size of toolbar vertically. */
|
|
110
|
+
this.size = "large";
|
|
111
|
+
this.selectedTab = 0;
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
const logoSrc = typeof this.logo === 'string' || this.logo instanceof URL ? (typeof this.logo === 'string' ? this.logo : this.logo.href) : '';
|
|
115
|
+
return html `
|
|
116
|
+
<header class=${headerVariants({ size: this.size })}>
|
|
117
|
+
<a href="/" class="flex flex-row">
|
|
118
|
+
${(logoSrc.length > 0) ? html `
|
|
119
|
+
<img
|
|
120
|
+
id="logo"
|
|
121
|
+
src="${this.logo}"
|
|
122
|
+
alt="Logo"
|
|
123
|
+
class="h-10 px-10 hover:opacity-90"
|
|
124
|
+
>
|
|
125
|
+
` : null}
|
|
126
|
+
|
|
127
|
+
${(this.title.length > 0) ? html `
|
|
128
|
+
<h1 class="text-2xl color-primary font-sans font-bold pl-3 m-0">${this.title}</h1>
|
|
129
|
+
` : null}
|
|
130
|
+
</a>
|
|
131
|
+
|
|
132
|
+
${ /* Navigation bar for desktop, hide on mobile */''}
|
|
133
|
+
<nav className="hidden sm:flex justify-between items-center gap-4 font-semibold">
|
|
134
|
+
<sl-tab-group>
|
|
135
|
+
${this.tabs.map((item, index) => html `
|
|
136
|
+
<sl-tab
|
|
137
|
+
slot="nav"
|
|
138
|
+
panel="general"
|
|
139
|
+
@click=${(e) => { this._selectTab(e, item.clickEvent, index); }}
|
|
140
|
+
?selected=${this.selectedTab === index}
|
|
141
|
+
>${item.label}</sl-tab>
|
|
142
|
+
`)}
|
|
143
|
+
</sl-tab-group>
|
|
144
|
+
</nav>
|
|
145
|
+
|
|
146
|
+
${ /* Stacked navigation drawer for mobile */''}
|
|
147
|
+
${ /* NOTE this should probably be in a drawer instead */''}
|
|
148
|
+
<nav className="sm:hidden flex flex-col items-end gap-1 font-semibold">
|
|
149
|
+
</nav>
|
|
150
|
+
|
|
151
|
+
<div id="right-section" style="display: flex; align-items: center;">
|
|
152
|
+
<sl-icon-button
|
|
153
|
+
library="bundled"
|
|
154
|
+
name="person-circle"
|
|
155
|
+
style="font-size: 1.8rem;"
|
|
156
|
+
label="login"
|
|
157
|
+
@click=${(e) => { this._handleLogin(e); }}
|
|
158
|
+
></sl-icon-button>
|
|
159
|
+
|
|
160
|
+
<div id="drawer-block" style="font-size: 2rem;">
|
|
161
|
+
${this.drawer ? html `
|
|
162
|
+
<sl-icon-button library="bundled" name="list" label="drawer-open"></sl-icon-button>
|
|
163
|
+
` : null}
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</header>
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
169
|
+
_selectTab(_e, clickAction, index) {
|
|
170
|
+
this.selectedTab = index;
|
|
171
|
+
clickAction();
|
|
172
|
+
}
|
|
173
|
+
_handleLogin(_e) {
|
|
174
|
+
this.dispatchEvent(new Event("login"));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
Header.styles = [
|
|
178
|
+
css `@unocss-placeholder;`,
|
|
179
|
+
css `
|
|
180
|
+
#right-section {
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
sl-tab-group {
|
|
186
|
+
display: flex;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
sl-tab::part(base) {
|
|
190
|
+
font-size: 1rem;
|
|
191
|
+
border-bottom: 2px solid transparent;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
sl-tab[selected]::part(base) {
|
|
195
|
+
border-bottom: 2px solid white;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
#drawer-block {
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
padding-right: 30px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@media(prefers-color-scheme: light) {
|
|
205
|
+
header {
|
|
206
|
+
color: black;
|
|
207
|
+
}
|
|
208
|
+
#break {
|
|
209
|
+
background-color: black;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
`
|
|
213
|
+
];
|
|
214
|
+
__decorate([
|
|
215
|
+
property()
|
|
216
|
+
], Header.prototype, "name", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: String })
|
|
219
|
+
], Header.prototype, "title", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ type: String })
|
|
222
|
+
], Header.prototype, "logo", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: Boolean })
|
|
225
|
+
], Header.prototype, "drawer", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ type: Array })
|
|
228
|
+
], Header.prototype, "tabs", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property({ type: String })
|
|
231
|
+
], Header.prototype, "size", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
state()
|
|
234
|
+
], Header.prototype, "selectedTab", void 0);
|
|
235
|
+
export default Header;
|
|
236
|
+
// Define web component
|
|
237
|
+
customElements.define("hot-header", Header);
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import "../../theme/sl-custom.css";
|
|
2
|
+
|
|
3
|
+
import '@shoelace-style/shoelace/dist/components/icon-button/icon-button.js';
|
|
4
|
+
import '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
|
5
|
+
import '@shoelace-style/shoelace/dist/components/tab-group/tab-group.js';
|
|
6
|
+
import '@shoelace-style/shoelace/dist/components/tab/tab.js';
|
|
7
|
+
|
|
8
|
+
import { LitElement, css, html } from "lit";
|
|
9
|
+
import { property, state } from "lit/decorators.js";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
|
|
12
|
+
import registerBundledIcons from '../../components/icons';
|
|
13
|
+
|
|
14
|
+
registerBundledIcons();
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const headerVariants = cva(
|
|
18
|
+
// Defaults to include in all variants
|
|
19
|
+
`
|
|
20
|
+
flex flex-row bg-[var(--hot-white)] items-center justify-between
|
|
21
|
+
sm:justify-around p-2 border-b-2 border-b-gray-100 border-b-solid
|
|
22
|
+
`,
|
|
23
|
+
{
|
|
24
|
+
variants: {
|
|
25
|
+
size: {
|
|
26
|
+
small: "h-8",
|
|
27
|
+
large: "h-14",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
type sizes = "small" | "large";
|
|
33
|
+
|
|
34
|
+
interface MenuItem {
|
|
35
|
+
label: string,
|
|
36
|
+
clickEvent: () => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class Header extends LitElement {
|
|
40
|
+
@property() name = "hot-header";
|
|
41
|
+
|
|
42
|
+
/** Use a text-based title in the header. */
|
|
43
|
+
@property({ type: String }) title: string = '';
|
|
44
|
+
|
|
45
|
+
/** Display a logo on the left of the header. */
|
|
46
|
+
@property({ type: String }) logo: string | URL = `
|
|
47
|
+
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAB9CAMAAAAvBq6hAAAAbFBMVEX
|
|
48
|
+
////XPz/ke3vura3++vr32dn76+vYRET65eX10ND88PDxurrkfX3cVlb99PTkf3/zxMThb2/tqKjv
|
|
49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+vt1lvYn3K2132Y2o4IDP2qnx9nwu2tFeOrAG03QKaVDLvx3o8SvqHwVrFcfFrzEylXJZLlTkI
|
|
111
|
+
vXoeoy+OGO3EF/XueH175WssAF1D/EZR1ZoXdfTTr14SB+I8iNj+UNaPNOhmZ7pPotj9bQrrcUj1R
|
|
112
|
+
QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQ+Gf4H5j7yuOYiAtqAAAAAElFTkSuQmCC
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
/** Add a drawer icon with a click event to e.g. open a sidebar. */
|
|
116
|
+
@property({ type: Boolean }) drawer: boolean = true;
|
|
117
|
+
|
|
118
|
+
/** Array of menu items to include as navigation tabs. */
|
|
119
|
+
@property({ type: Array }) tabs: MenuItem[] = [];
|
|
120
|
+
|
|
121
|
+
/** Size of toolbar vertically. */
|
|
122
|
+
@property({ type: String }) size: sizes = "large";
|
|
123
|
+
|
|
124
|
+
@state() private selectedTab: number = 0;
|
|
125
|
+
|
|
126
|
+
static styles = [
|
|
127
|
+
css`@unocss-placeholder;`,
|
|
128
|
+
css`
|
|
129
|
+
#right-section {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
sl-tab-group {
|
|
135
|
+
display: flex;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
sl-tab::part(base) {
|
|
139
|
+
font-size: 1rem;
|
|
140
|
+
border-bottom: 2px solid transparent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
sl-tab[selected]::part(base) {
|
|
144
|
+
border-bottom: 2px solid white;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#drawer-block {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
padding-right: 30px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media(prefers-color-scheme: light) {
|
|
154
|
+
header {
|
|
155
|
+
color: black;
|
|
156
|
+
}
|
|
157
|
+
#break {
|
|
158
|
+
background-color: black;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
protected render() {
|
|
165
|
+
const logoSrc = typeof this.logo === 'string' || this.logo instanceof URL ? (typeof this.logo === 'string' ? this.logo : this.logo.href) : '';
|
|
166
|
+
|
|
167
|
+
return html`
|
|
168
|
+
<header class=${headerVariants({size: this.size})}>
|
|
169
|
+
<a href="/" class="flex flex-row">
|
|
170
|
+
${(logoSrc.length > 0) ? html`
|
|
171
|
+
<img
|
|
172
|
+
id="logo"
|
|
173
|
+
src="${this.logo}"
|
|
174
|
+
alt="Logo"
|
|
175
|
+
class="h-10 px-10 hover:opacity-90"
|
|
176
|
+
>
|
|
177
|
+
` : null}
|
|
178
|
+
|
|
179
|
+
${(this.title.length > 0) ? html`
|
|
180
|
+
<h1 class="text-2xl color-primary font-sans font-bold pl-3 m-0">${this.title}</h1>
|
|
181
|
+
` : null}
|
|
182
|
+
</a>
|
|
183
|
+
|
|
184
|
+
${ /* Navigation bar for desktop, hide on mobile */'' }
|
|
185
|
+
<nav className="hidden sm:flex justify-between items-center gap-4 font-semibold">
|
|
186
|
+
<sl-tab-group>
|
|
187
|
+
${this.tabs.map(
|
|
188
|
+
(item, index) => html`
|
|
189
|
+
<sl-tab
|
|
190
|
+
slot="nav"
|
|
191
|
+
panel="general"
|
|
192
|
+
@click=${(e: MouseEvent) => { this._selectTab(e, item.clickEvent, index); }}
|
|
193
|
+
?selected=${this.selectedTab === index}
|
|
194
|
+
>${item.label}</sl-tab>
|
|
195
|
+
`
|
|
196
|
+
)}
|
|
197
|
+
</sl-tab-group>
|
|
198
|
+
</nav>
|
|
199
|
+
|
|
200
|
+
${ /* Stacked navigation drawer for mobile */'' }
|
|
201
|
+
${ /* NOTE this should probably be in a drawer instead */'' }
|
|
202
|
+
<nav className="sm:hidden flex flex-col items-end gap-1 font-semibold">
|
|
203
|
+
</nav>
|
|
204
|
+
|
|
205
|
+
<div id="right-section" style="display: flex; align-items: center;">
|
|
206
|
+
<sl-icon-button
|
|
207
|
+
library="bundled"
|
|
208
|
+
name="person-circle"
|
|
209
|
+
style="font-size: 1.8rem;"
|
|
210
|
+
label="login"
|
|
211
|
+
@click=${(e: MouseEvent) => { this._handleLogin(e)}}
|
|
212
|
+
></sl-icon-button>
|
|
213
|
+
|
|
214
|
+
<div id="drawer-block" style="font-size: 2rem;">
|
|
215
|
+
${this.drawer ? html`
|
|
216
|
+
<sl-icon-button library="bundled" name="list" label="drawer-open"></sl-icon-button>
|
|
217
|
+
` : null}
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</header>
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private _selectTab(_e: MouseEvent, clickAction: () => void, index: number) {
|
|
225
|
+
this.selectedTab = index;
|
|
226
|
+
clickAction();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private _handleLogin(_e: MouseEvent) {
|
|
230
|
+
this.dispatchEvent(new Event("login"));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export default Header;
|
|
235
|
+
|
|
236
|
+
// Define web component
|
|
237
|
+
customElements.define("hot-header", Header);
|
package/components/icons.js
CHANGED
|
@@ -57,6 +57,12 @@ const icons = {
|
|
|
57
57
|
<path fill-rule="evenodd" d="M6 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-4-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>
|
|
58
58
|
</svg>
|
|
59
59
|
`,
|
|
60
|
+
'person-circle': `
|
|
61
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
|
|
62
|
+
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
|
|
63
|
+
<path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
|
|
64
|
+
</svg>
|
|
65
|
+
`
|
|
60
66
|
};
|
|
61
67
|
const libraryResolver = (name) => {
|
|
62
68
|
if (name in icons) {
|