Skip to content

Commit

Permalink
Use shoelace
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Oct 24, 2024
1 parent 4095df4 commit 37864a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
16 changes: 1 addition & 15 deletions src/apps/illumination/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Revolutionary illumination / solar app</title>
<!-- <link rel="stylesheet" href="./src/index.css" /> -->
<script type="module" src="./index.ts"></script>

<style>
/* FIXME: move to default style */
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
margin: 0;
}
</style>
<script type="module" src="./index.ts"></script>
</head>
<body>
<noscript>Enable JS!</noscript>
Expand Down
3 changes: 3 additions & 0 deletions src/structure/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* FIXME: include reset css */

@import url('@shoelace-style/shoelace/dist/themes/light.css');
2 changes: 2 additions & 0 deletions src/structure/ngv-structure-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {getLocale} from './helpers/localeHelper.js';
import './ngv-page.js';
import './ngv-structure-header.js';

import './index.css';

export interface INgvStructureApp {
languages: Locale[];
header: {
Expand Down
16 changes: 10 additions & 6 deletions src/structure/ngv-structure-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import {customElement, property} from 'lit/decorators.js';
import type {INgvStructureApp} from './ngv-structure-app.js';
import {getLocale, setLocale} from './helpers/localeHelper.js';

import '@shoelace-style/shoelace/dist/components/select/select.js';
import '@shoelace-style/shoelace/dist/components/option/option.js';

@customElement('ngv-structure-header')
export class NgvStructureHeader extends LitElement {
@property({type: Object})
Expand All @@ -24,23 +27,24 @@ export class NgvStructureHeader extends LitElement {
<header>
<img src="${this.config.header.logo}" />
<div>
<label for="language">Lang:</label>
<select
<sl-select
name="language"
id="language"
@change=${async (evt: Event) => {
label="Language"
size="small"
@sl-change=${async (evt: Event) => {
const el = evt.target as HTMLSelectElement;
const locale = this.config.languages[el.selectedIndex];
await setLocale(locale);
}}
>
${this.config.languages.map(
(l) =>
html`<option value="${l}" ?selected=${l === currentLocale}>
html`<sl-option value="${l}" ?selected=${l === currentLocale}>
${l}
</option>`,
</sl-option>`,
)}
</select>
</sl-select>
</div>
</header>
`;
Expand Down

0 comments on commit 37864a4

Please sign in to comment.