-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
133 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import { LitElement, html, css } from 'lit'; | ||
import { customElement, query } from 'lit/decorators.js'; | ||
import { serialize } from '@shoelace-style/shoelace/dist/utilities/form.js'; | ||
|
||
@customElement('app-bar') | ||
export class AppBar extends LitElement { | ||
static styles = css` | ||
:host { | ||
height: 100vh; | ||
width: 100vw; | ||
} | ||
header { | ||
display: flex; | ||
align-items: center; | ||
background-color: #fefefe; | ||
border-bottom: 1px solid #dfdfdf; | ||
} | ||
.icon-button-group { | ||
padding: 0 5px; | ||
} | ||
.address-form { | ||
flex: 1; | ||
padding: 3px 5px; | ||
} | ||
sl-icon-button { | ||
font-size: 1.2rem; | ||
} | ||
`; | ||
|
||
@query('.address-form') | ||
formElem?: HTMLFormElement; | ||
|
||
render() { | ||
return html` | ||
<header> | ||
<div class="icon-button-group"> | ||
<sl-icon-button | ||
name="chevron-left" | ||
@click=${this.goBack} | ||
></sl-icon-button> | ||
<sl-icon-button | ||
name="chevron-right" | ||
@click=${this.goForward} | ||
></sl-icon-button> | ||
<sl-icon-button name="house" @click=${this.goHome}></sl-icon-button> | ||
</div> | ||
<form @submit=${this.onSubmit} class="address-form"> | ||
<sl-input name="address" placeholder="https://" filled> | ||
<!-- <sl-icon-button | ||
name="arrow-clockwise" | ||
slot="prefix" | ||
style="--sl-input-spacing-medium: var(--sl-spacing-x-small)" | ||
></sl-icon-button> --> | ||
<sl-icon-button | ||
name="arrow-right" | ||
slot="suffix" | ||
style="--sl-input-spacing-medium: var(--sl-spacing-x-small)" | ||
@click=${this.goToAddress} | ||
></sl-icon-button> | ||
<!-- <sl-icon-button | ||
name="x-lg" | ||
slot="prefix" | ||
style="--sl-input-spacing-medium: var(--sl-spacing-x-small)" | ||
></sl-icon-button> --> | ||
</sl-input> | ||
</form> | ||
<div> | ||
<sl-icon-button name="zoom-in" @click=${this.zoomIn}></sl-icon-button> | ||
<sl-icon-button | ||
name="zoom-out" | ||
@click=${this.zoomOut} | ||
></sl-icon-button> | ||
<sl-icon-button | ||
name="printer" | ||
@click=${this.printPage} | ||
></sl-icon-button> | ||
</div> | ||
</header> | ||
`; | ||
} | ||
|
||
private onSubmit(e: Event) { | ||
e.preventDefault(); | ||
this.goToAddress(); | ||
} | ||
|
||
private goToAddress() { | ||
console.log( | ||
'TODO goToAddress:', | ||
new FormData(this.formElem).get('address'), | ||
serialize(this.formElem) | ||
); | ||
} | ||
|
||
private goBack() { | ||
console.log('TODO goBack'); | ||
} | ||
|
||
private goForward() { | ||
console.log('TODO goForward'); | ||
} | ||
|
||
private goHome() { | ||
console.log('TODO goHome'); | ||
} | ||
|
||
private zoomIn() { | ||
console.log('TODO zoomIn'); | ||
} | ||
|
||
private zoomOut() { | ||
console.log('TODO zoomOut'); | ||
} | ||
|
||
private printPage() { | ||
console.log('TODO printPage'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,14 @@ | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, | ||
Arial, sans-serif; | ||
margin: 0; | ||
} | ||
|
||
#app { | ||
height: 100vh; | ||
width: 100vw; | ||
} | ||
|
||
#app-bar { | ||
display: flex; | ||
align-items: center; | ||
background-color: #fefefe; | ||
border-bottom: 1px solid #dfdfdf; | ||
} | ||
|
||
#app-main { | ||
#webview { | ||
background: #eee; | ||
height: calc(100vh - 47px); | ||
} | ||
|
||
.address-input-wrapper { | ||
flex: 1; | ||
padding: 3px 5px; | ||
} | ||
|
||
.icon-button-group { | ||
padding: 0 5px; | ||
} | ||
|
||
sl-icon-button { | ||
font-size: 1.2rem; | ||
height: calc(100vh - 47px); /* app height - app bar height */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters