From a718043fa844d9a8856efd41355760f3367f2a4c Mon Sep 17 00:00:00 2001 From: Henry Wilkinson Date: Tue, 6 Jun 2023 20:54:17 -0400 Subject: [PATCH] Adds icon `name` and tooltip `content` fields to `btrix-copy-button` (#879) - Adds two new properties, name to pick the icon's name and content to pick a custom tooltip message. These are in-line with what Shoelace uses but are perhaps not the best descriptors... - Swaps the existing anchor links on the Workflow Details' Settings tab for these and relocates them to after the heading. (Navigation to the links is broken right now... but the copying part works nicely!) - Updates btrix-section-heading to better handle multiple elements with flexbox and an 8px gap between elements --- frontend/src/components/config-details.ts | 45 +++++++++++++--------- frontend/src/components/copy-button.ts | 11 ++++-- frontend/src/components/section-heading.ts | 3 ++ 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/config-details.ts b/frontend/src/components/config-details.ts index 1b14bd37..eeb8a3f6 100644 --- a/frontend/src/components/config-details.ts +++ b/frontend/src/components/config-details.ts @@ -89,10 +89,12 @@ export class ConfigDetails extends LiteElement { return html`

- ${this.renderAnchorLink("crawler-settings")} + > +

${msg("Crawler Settings")} -

+ ${this.renderAnchorLink("crawler-settings")} + ${when( @@ -165,10 +167,12 @@ export class ConfigDetails extends LiteElement {

- ${this.renderAnchorLink("browser-settings")} + > +

${msg("Browser Settings")} -

+ ${this.renderAnchorLink("browser-settings")} + ${this.renderSetting( @@ -199,10 +203,12 @@ export class ConfigDetails extends LiteElement {

- ${this.renderAnchorLink("crawl-scheduling")} + > +

${msg("Crawl Scheduling")} -

+ ${this.renderAnchorLink("crawl-scheduling")} + ${this.renderSetting( @@ -222,10 +228,13 @@ export class ConfigDetails extends LiteElement {
- +

- ${this.renderAnchorLink("crawl-metadata")}${msg("Crawl Metadata")} -

+ ${this.renderAnchorLink("crawl-metadata")} +
${this.renderSetting(msg("Name"), crawlConfig?.name)} @@ -341,12 +350,12 @@ export class ConfigDetails extends LiteElement { if (!this.anchorLinks) return; const currentUrl = window.location.href; return html` - - - + `; } diff --git a/frontend/src/components/copy-button.ts b/frontend/src/components/copy-button.ts index 8ef80d0d..2e933a51 100644 --- a/frontend/src/components/copy-button.ts +++ b/frontend/src/components/copy-button.ts @@ -21,6 +21,12 @@ export class CopyButton extends LitElement { @property({ type: String }) value?: string; + @property({ type: String }) + name?: string; + + @property({ type: String }) + content?: string; + @property({ type: Function }) getValue?: () => string; @@ -40,10 +46,9 @@ export class CopyButton extends LitElement { render() { return html` - +