From acd3e1252dc570eb9a53da07eab17751e001a92c Mon Sep 17 00:00:00 2001 From: sua yoo Date: Fri, 23 Aug 2024 18:11:29 -0700 Subject: [PATCH] feat: Add help shortcuts to app header & footer (#2040) WIP for https://github.com/webrecorder/browsertrix/issues/2041 ### Changes - Adds button to open embedded support guide - Adds link to help forum - Refactors app bar to look nicer on smaller screens --- frontend/src/index.ts | 178 +++++++++++++++++++----------- frontend/src/shoelace.ts | 1 + frontend/src/theme.stylesheet.css | 14 +++ 3 files changed, 129 insertions(+), 64 deletions(-) diff --git a/frontend/src/index.ts b/frontend/src/index.ts index dbf07c73..4fad0a34 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -1,5 +1,5 @@ import { localized, msg, str } from "@lit/localize"; -import type { SlDialog } from "@shoelace-style/shoelace"; +import type { SlDialog, SlDrawer } from "@shoelace-style/shoelace"; import { nothing, render, type TemplateResult } from "lit"; import { customElement, property, query, state } from "lit/decorators.js"; import { when } from "lit/directives/when.js"; @@ -72,6 +72,9 @@ export class App extends LiteElement { @query("#globalDialog") private readonly globalDialog!: SlDialog; + @query("#userGuideDrawer") + private readonly userGuideDrawer!: SlDrawer; + async connectedCallback() { let authState: AuthService["authState"] = null; try { @@ -250,7 +253,9 @@ export class App extends LiteElement {
${this.renderNavBar()} ${this.renderAlertBanner()}
${this.renderPage()}
-
${this.renderFooter()}
+
+ ${this.renderFooter()} +
(this.globalDialogContent = {})} >${this.globalDialogContent.body} + + + + + ${msg("User Guide")} + + + + + ${msg("Open in new window")} + `; } @@ -307,9 +331,9 @@ export class App extends LiteElement { return html`
`; @@ -443,21 +491,23 @@ export class App extends LiteElement { const orgNameLength = 50; return html` - ${selectedOption.slug - ? html` - - ${selectedOption.name.slice(0, orgNameLength)} - - ` - : html` - - ${selectedOption.name.slice(0, orgNameLength)} - - `} +
+ ${selectedOption.slug + ? html` + + ${selectedOption.name.slice(0, orgNameLength)} + + ` + : html` + + ${selectedOption.name.slice(0, orgNameLength)} + + `} +
${when( orgs.length > 1, () => html` @@ -565,12 +615,12 @@ export class App extends LiteElement {
- - ${msg("Documentation")} + + ${msg("Help Forum")}
${this.version diff --git a/frontend/src/shoelace.ts b/frontend/src/shoelace.ts index 0dbd3742..8974f6c3 100644 --- a/frontend/src/shoelace.ts +++ b/frontend/src/shoelace.ts @@ -9,6 +9,7 @@ import "@shoelace-style/shoelace/dist/themes/light.css"; import "@shoelace-style/shoelace/dist/components/alert/alert"; import "@shoelace-style/shoelace/dist/components/avatar/avatar"; import "@shoelace-style/shoelace/dist/components/button/button"; +import "@shoelace-style/shoelace/dist/components/drawer/drawer"; import "@shoelace-style/shoelace/dist/components/icon/icon"; import "@shoelace-style/shoelace/dist/components/input/input"; import "@shoelace-style/shoelace/dist/components/checkbox/checkbox"; diff --git a/frontend/src/theme.stylesheet.css b/frontend/src/theme.stylesheet.css index 203c8f64..c65f651b 100644 --- a/frontend/src/theme.stylesheet.css +++ b/frontend/src/theme.stylesheet.css @@ -340,6 +340,20 @@ border: 1px solid theme(colors.gray.200); border-radius: var(--sl-input-border-radius-small); } + + sl-drawer::part(header) { + --header-spacing: var(--sl-spacing-small); + } + + sl-drawer::part(title) { + font-size: var(--font-size-base); + font-weight: var(--sl-font-weight-medium); + line-height: 1.5; + } + + sl-drawer::part(footer) { + border-top: 1px solid var(--sl-panel-border-color); + } } /* Following styles won't work with layers */