-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Org settings layout fix + misc styling & consistency improvements (#1427
) ## General changes - Added `postcss-lit`, which allows us to use tailwind in lit elements with shadow DOMs - Added `// postcss-lit-disable-next-line` comments to most `` css`...` `` tagged templates so as not to change existing CSS in components - Added `TailwindElement`, which uses a single shared `CSSStyleSheet` across all instances to be able to access Tailwind without requiring a full copy of (compiled) Tailwind for every instance of a component that extends it - Added a new `<btrix-copy-field>` element, replacing the existing copy elements ## Org settings page - Stopped content from overflowing at medium widths - Made spacing consistent at both smaller and wider widths - Used readonly/monospace styling for copyable org id field - Updated tab shadows to be slightly blue, consistent with the tab background (also did this in other places tabs show up) Before | After -|- ![dev browsertrix cloud_orgs_default-org_settings](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/9bcacdcc-259b-4a01-bac5-8913518776f0) | ![localhost_9870_orgs_default-org_workflows_crawls](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/53936d4d-e5cd-4f37-ad06-b3b5041381df) ![dev browsertrix cloud_orgs_default-org_settings (3)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/602dd8d6-3012-4a0e-a638-a5192c9601ec) | ![localhost_9870_orgs_default-org_workflows_crawls (3)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/74c93312-ad26-48d8-a87e-3da9a851693b) ## Misc fixes - Used consistent single-line readonly/monospace styling for copyable url field Before | After -|- ![dev browsertrix cloud_orgs_default-org_settings (1)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/e361feeb-3ea0-4f56-9e38-12ef6a644d58) | ![localhost_9870_orgs_default-org_workflows_crawls (1)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/0145b1ad-8f45-4486-893e-8f638ac9add6) - Removed inconsistent angled bottom borders from crawl workflow list header Before | After -|- ![dev browsertrix cloud_orgs_default-org_settings (2)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/4aa20359-3ecf-4441-83c0-ed36a951ed3b) | ![localhost_9870_orgs_default-org_workflows_crawls (2)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/8c771464-3a70-47e7-8475-fa82d4d030a9) - Changes _all_ list page primary action buttons to use `variant="primary"` <img width="190" alt="Screenshot 2023-12-08 at 11 23 49 AM" src="https://github.com/webrecorder/browsertrix-cloud/assets/5672810/2b007f5e-e675-40b2-86a7-f0bf8ef83b81"> <img width="240" alt="Screenshot 2023-12-08 at 11 23 43 AM" src="https://github.com/webrecorder/browsertrix-cloud/assets/5672810/621b340e-2051-4ab0-8f42-8f0a51d8d3a5"> --------- Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics> Co-authored-by: sua yoo <sua@webrecorder.org> Co-authored-by: sua yoo <sua@suayoo.com>
- Loading branch information
1 parent
2bb21c6
commit 73e2026
Showing
39 changed files
with
706 additions
and
422 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
declare module "*.svg"; | ||
declare module "*.webp"; | ||
declare module "*.css"; | ||
declare module "regex-colorize"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
module.exports = { | ||
plugins: [require("tailwindcss"), require("autoprefixer")], | ||
}; |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
* }, | ||
* }, | ||
*/ | ||
export default ""; |
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,18 @@ | ||
import { LitElement } from "lit"; | ||
import { theme } from "@/theme"; | ||
|
||
export class TailwindElement extends LitElement { | ||
connectedCallback(): void { | ||
super.connectedCallback(); | ||
// Insert the compiled Tailwind css into the shadow root. | ||
// This has the benefit of not requiring a whole copy of compiled Tailwind | ||
// for every TailwindElement, so we still get the benefits of atomic CSS. | ||
// And because Tailwind uses `@layer`[^1], the order of declarations ends up | ||
// correct, and you can use component styles with `static styles = ...`, | ||
// *and* you can use Tailwind functions and directives in those styles | ||
// thanks to `postcss-lit`. | ||
// | ||
// [^1]: (see https://tailwindcss.com/docs/adding-custom-styles#using-css-and-layer), | ||
this.shadowRoot?.adoptedStyleSheets.push(theme); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { css, html } from "lit"; | ||
import { customElement, property } from "lit/decorators.js"; | ||
import { localized } from "@lit/localize"; | ||
import { TailwindElement } from "@/classes/TailwindElement"; | ||
import { classMap } from "lit/directives/class-map.js"; | ||
|
||
/** | ||
* Copy text to clipboard on click | ||
* | ||
* @example | ||
* ```ts | ||
* <btrix-copy-field label="my field" value=${value}></btrix-copy-field> | ||
* ``` | ||
*/ | ||
@localized() | ||
@customElement("btrix-copy-field") | ||
export class CopyField extends TailwindElement { | ||
@property({ type: String }) | ||
value?: string; | ||
|
||
@property({ type: Boolean }) | ||
hideContentFromScreenReaders = false; | ||
|
||
@property({ type: String }) | ||
buttonIconName?: string; | ||
|
||
@property({ type: String }) | ||
buttonContent?: string; | ||
|
||
@property({ attribute: false }) | ||
getValue?: () => string | undefined; | ||
|
||
@property({ type: Boolean }) | ||
hoist = false; | ||
|
||
@property({ type: Boolean }) | ||
monostyle = true; | ||
|
||
@property({ type: Boolean }) | ||
filled = this.monostyle; | ||
|
||
@property() | ||
label?: string; | ||
|
||
static styles = css` | ||
:host { | ||
display: block; | ||
} | ||
`; | ||
|
||
get _slottedChildren() { | ||
const slot = this.shadowRoot?.querySelector("slot[name=label]"); | ||
return (slot as HTMLSlotElement | null | undefined)?.assignedElements(); | ||
} | ||
|
||
render() { | ||
return html` | ||
<div role="group"> | ||
<label | ||
class="text-neutral-800 font-sans mb-1.5 text-xs leading-[1.4] inline-block ${classMap( | ||
{ hidden: !this.label && !this._slottedChildren } | ||
)}" | ||
><slot name="label">${this.label}</slot></label | ||
> | ||
<div | ||
class="rounded border inline-flex items-stretch justify-start relative w-full ${classMap( | ||
{ "bg-slate-50": this.filled, "font-monostyle": this.monostyle } | ||
)}" | ||
> | ||
<slot name="prefix"></slot> | ||
<span | ||
aria-hidden=${this.hideContentFromScreenReaders} | ||
class="flex-auto px-1.5 mx-1.5 text-neutral-700 self-center select-all overflow-x-auto whitespace-nowrap" | ||
> | ||
${this.value} | ||
</span> | ||
<btrix-copy-button | ||
.value=${this.value} | ||
.name=${this.buttonIconName} | ||
.content=${this.buttonContent} | ||
.getValue=${this.getValue} | ||
.hoist=${this.hoist} | ||
></btrix-copy-button> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} |
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
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
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
Oops, something went wrong.