Small UI fixes (#1934)
Fixes a few things that have been bugging me:
- Overflow buttons in list view now (mostly) take up the their full cell
area, instead of there being a couple pixels around the button where
clicking would do nothing or cause navigation
- | before | after |
| --- | --- |
| <img width="238" alt="Screenshot 2024-07-16 at 3 35 25 PM"
src="https://github.com/user-attachments/assets/afbda6d6-703b-4ed8-96be-a9c37660430d">
| <img width="236" alt="Screenshot 2024-07-16 at 3 35 02 PM"
src="https://github.com/user-attachments/assets/417a326a-08d2-42b2-85c3-fa007ea3bff8">
|
- Changes the class that `tab-list` uses internally so that it doesn't
conflict with Tailwind's `container` class, which prevents the tab
content from being limited at the default Tailwind container width
- Adds a couple of Tailwind plugins for styling CSS parts
(`part-[...]:`) and for arbitrary attributes (`attr-[...]:`)
This commit is contained in:
parent
5e9e897713
commit
224b011070
4
frontend/config/tailwind/plugins/attributes.js
Normal file
4
frontend/config/tailwind/plugins/attributes.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
const plugin = require("tailwindcss/plugin");
|
||||||
|
module.exports = plugin(function ({ matchVariant }) {
|
||||||
|
matchVariant("attr", (value) => `&[${value}]`);
|
||||||
|
});
|
||||||
4
frontend/config/tailwind/plugins/parts.js
Normal file
4
frontend/config/tailwind/plugins/parts.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
const plugin = require("tailwindcss/plugin");
|
||||||
|
module.exports = plugin(function ({ matchVariant }) {
|
||||||
|
matchVariant("part", (value) => `&::part(${value})`);
|
||||||
|
});
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { localized, msg } from "@lit/localize";
|
import { localized, msg } from "@lit/localize";
|
||||||
import type { SlDropdown, SlMenu } from "@shoelace-style/shoelace";
|
import type { SlDropdown, SlMenu } from "@shoelace-style/shoelace";
|
||||||
import { css, html, LitElement } from "lit";
|
import { html } from "lit";
|
||||||
import {
|
import {
|
||||||
customElement,
|
customElement,
|
||||||
query,
|
query,
|
||||||
@ -8,6 +8,8 @@ import {
|
|||||||
state,
|
state,
|
||||||
} from "lit/decorators.js";
|
} from "lit/decorators.js";
|
||||||
|
|
||||||
|
import { TailwindElement } from "@/classes/TailwindElement";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dropdown for additional actions.
|
* Dropdown for additional actions.
|
||||||
*
|
*
|
||||||
@ -23,19 +25,7 @@ import {
|
|||||||
*/
|
*/
|
||||||
@localized()
|
@localized()
|
||||||
@customElement("btrix-overflow-dropdown")
|
@customElement("btrix-overflow-dropdown")
|
||||||
export class OverflowDropdown extends LitElement {
|
export class OverflowDropdown extends TailwindElement {
|
||||||
static style = [
|
|
||||||
css`
|
|
||||||
.trigger {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.trigger[disabled] {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
];
|
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
private hasMenuItems?: boolean;
|
private hasMenuItems?: boolean;
|
||||||
|
|
||||||
@ -50,7 +40,7 @@ export class OverflowDropdown extends LitElement {
|
|||||||
<sl-dropdown ?disabled=${!this.hasMenuItems} hoist>
|
<sl-dropdown ?disabled=${!this.hasMenuItems} hoist>
|
||||||
<sl-icon-button
|
<sl-icon-button
|
||||||
slot="trigger"
|
slot="trigger"
|
||||||
class="trigger"
|
class="font-base attr-[disabled]:invisible part-[base]:p-3"
|
||||||
label=${msg("Actions")}
|
label=${msg("Actions")}
|
||||||
name="three-dots-vertical"
|
name="three-dots-vertical"
|
||||||
?disabled=${!this.hasMenuItems}
|
?disabled=${!this.hasMenuItems}
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export class TabList extends TailwindElement {
|
|||||||
--track-width: 4px;
|
--track-width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.btrix-tab-list-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"menu"
|
"menu"
|
||||||
@ -94,7 +94,7 @@ export class TabList extends TailwindElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: ${TWO_COL_SCREEN_MIN_CSS}) {
|
@media only screen and (min-width: ${TWO_COL_SCREEN_MIN_CSS}) {
|
||||||
.container {
|
.btrix-tab-list-container {
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
". header"
|
". header"
|
||||||
"menu main";
|
"menu main";
|
||||||
@ -227,7 +227,7 @@ export class TabList extends TailwindElement {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return html`
|
return html`
|
||||||
<div class="container">
|
<div class="btrix-tab-list-container">
|
||||||
<div class="navWrapper min-w-0">${this.renderNav()}</div>
|
<div class="navWrapper min-w-0">${this.renderNav()}</div>
|
||||||
<div class="header"><slot name="header"></slot></div>
|
<div class="header"><slot name="header"></slot></div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|||||||
@ -329,7 +329,7 @@ export class ArchivedItemDetailQA extends TailwindElement {
|
|||||||
<btrix-table-header-cell>
|
<btrix-table-header-cell>
|
||||||
${msg("Started by")}
|
${msg("Started by")}
|
||||||
</btrix-table-header-cell>
|
</btrix-table-header-cell>
|
||||||
<btrix-table-header-cell class="px-1">
|
<btrix-table-header-cell class="px-0">
|
||||||
<span class="sr-only">${msg("Row actions")}</span>
|
<span class="sr-only">${msg("Row actions")}</span>
|
||||||
</btrix-table-header-cell>
|
</btrix-table-header-cell>
|
||||||
</btrix-table-head>
|
</btrix-table-head>
|
||||||
@ -389,7 +389,7 @@ export class ArchivedItemDetailQA extends TailwindElement {
|
|||||||
: notApplicable()}
|
: notApplicable()}
|
||||||
</btrix-table-cell>
|
</btrix-table-cell>
|
||||||
<btrix-table-cell>${run.userName}</btrix-table-cell>
|
<btrix-table-cell>${run.userName}</btrix-table-cell>
|
||||||
<btrix-table-cell class="px-1">
|
<btrix-table-cell class="p-0">
|
||||||
<div class="col action">
|
<div class="col action">
|
||||||
<btrix-overflow-dropdown
|
<btrix-overflow-dropdown
|
||||||
@sl-show=${async (e: SlShowEvent) => {
|
@sl-show=${async (e: SlShowEvent) => {
|
||||||
|
|||||||
@ -389,7 +389,7 @@ export class CrawlsList extends TailwindElement {
|
|||||||
${items.length
|
${items.length
|
||||||
? html`
|
? html`
|
||||||
<btrix-archived-item-list .listType=${this.itemType}>
|
<btrix-archived-item-list .listType=${this.itemType}>
|
||||||
<btrix-table-header-cell slot="actionCell" class="px-1">
|
<btrix-table-header-cell slot="actionCell" class="p-0">
|
||||||
<span class="sr-only">${msg("Row actions")}</span>
|
<span class="sr-only">${msg("Row actions")}</span>
|
||||||
</btrix-table-header-cell>
|
</btrix-table-header-cell>
|
||||||
${repeat(items, ({ id }) => id, this.renderArchivedItem)}
|
${repeat(items, ({ id }) => id, this.renderArchivedItem)}
|
||||||
@ -602,7 +602,7 @@ export class CrawlsList extends TailwindElement {
|
|||||||
.item=${item}
|
.item=${item}
|
||||||
?showStatus=${this.itemType !== null}
|
?showStatus=${this.itemType !== null}
|
||||||
>
|
>
|
||||||
<btrix-table-cell slot="actionCell" class="px-1">
|
<btrix-table-cell slot="actionCell" class="p-0">
|
||||||
<btrix-overflow-dropdown
|
<btrix-overflow-dropdown
|
||||||
@click=${(e: MouseEvent) => {
|
@click=${(e: MouseEvent) => {
|
||||||
// Prevent navigation to detail view
|
// Prevent navigation to detail view
|
||||||
|
|||||||
@ -327,7 +327,7 @@ export class BrowserProfilesList extends TailwindElement {
|
|||||||
></sl-format-date>
|
></sl-format-date>
|
||||||
</sl-tooltip>
|
</sl-tooltip>
|
||||||
</btrix-table-cell>
|
</btrix-table-cell>
|
||||||
<btrix-table-cell class="px-1">
|
<btrix-table-cell class="p-0">
|
||||||
${this.renderActions(data)}
|
${this.renderActions(data)}
|
||||||
</btrix-table-cell>
|
</btrix-table-cell>
|
||||||
</btrix-table-row>
|
</btrix-table-row>
|
||||||
|
|||||||
@ -643,7 +643,7 @@ export class CollectionDetail extends LiteElement {
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<btrix-archived-item-list>
|
<btrix-archived-item-list>
|
||||||
<btrix-table-header-cell slot="actionCell" class="px-1">
|
<btrix-table-header-cell slot="actionCell" class="p-0">
|
||||||
<span class="sr-only">${msg("Row actions")}</span>
|
<span class="sr-only">${msg("Row actions")}</span>
|
||||||
</btrix-table-header-cell>
|
</btrix-table-header-cell>
|
||||||
${repeat(
|
${repeat(
|
||||||
@ -677,7 +677,7 @@ export class CollectionDetail extends LiteElement {
|
|||||||
>
|
>
|
||||||
${this.isCrawler
|
${this.isCrawler
|
||||||
? html`
|
? html`
|
||||||
<btrix-table-cell slot="actionCell" class="px-1">
|
<btrix-table-cell slot="actionCell" class="p-0">
|
||||||
<btrix-overflow-dropdown
|
<btrix-overflow-dropdown
|
||||||
@click=${(e: MouseEvent) => {
|
@click=${(e: MouseEvent) => {
|
||||||
// Prevent navigation to detail view
|
// Prevent navigation to detail view
|
||||||
|
|||||||
@ -553,7 +553,7 @@ export class CollectionsList extends LiteElement {
|
|||||||
minute="2-digit"
|
minute="2-digit"
|
||||||
></sl-format-date>
|
></sl-format-date>
|
||||||
</btrix-table-cell>
|
</btrix-table-cell>
|
||||||
<btrix-table-cell class="px-1">
|
<btrix-table-cell class="p-0">
|
||||||
${this.isCrawler ? this.renderActions(col) : ""}
|
${this.isCrawler ? this.renderActions(col) : ""}
|
||||||
</btrix-table-cell>
|
</btrix-table-cell>
|
||||||
</btrix-table-row>
|
</btrix-table-row>
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
const { tailwindTransform } = require("postcss-lit");
|
const { tailwindTransform } = require("postcss-lit");
|
||||||
|
|
||||||
|
const attributes = require("./config/tailwind/plugins/attributes");
|
||||||
const containPlugin = require("./config/tailwind/plugins/contain");
|
const containPlugin = require("./config/tailwind/plugins/contain");
|
||||||
const contentVisibilityPlugin = require("./config/tailwind/plugins/content-visibility");
|
const contentVisibilityPlugin = require("./config/tailwind/plugins/content-visibility");
|
||||||
|
const cssPartsPlugin = require("./config/tailwind/plugins/parts");
|
||||||
|
|
||||||
const PRIMARY_COLOR = "#0891B2";
|
const PRIMARY_COLOR = "#0891B2";
|
||||||
|
|
||||||
@ -163,7 +165,9 @@ module.exports = {
|
|||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
require("@tailwindcss/container-queries"),
|
require("@tailwindcss/container-queries"),
|
||||||
|
attributes,
|
||||||
containPlugin,
|
containPlugin,
|
||||||
contentVisibilityPlugin,
|
contentVisibilityPlugin,
|
||||||
|
cssPartsPlugin,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user