♻️ Use the DS button in the Design tab export menu (#13275)

* ♻️ Use the DS button in the Design tab export menu

The "Export N elements" button of the Export menu was a raw button with
the deprecated %button-secondary placeholder. It becomes a secondary
button*, as the Inspect export button already is, so it takes the DS
label, hover and disabled look. The btn-disabled class goes away: the
.scss never defined it, and button* styles the disabled state.

A zero-tolerance visual test shows the button at rest, on hover and
while exporting (the export request is held so the state stays), and
the export row, which the styles commit that follows must not change.

AI-assisted-by: claude-opus-5-5

* ♻️ Move the Design tab export menu styles to the DS

exports.scss drops the deprecated spacing, flex-row and typography
mixins and the %mixed-bar placeholder: DS sizes, borders, spacing
tokens and px2rem take their place, with logical properties. The
mixed bar colors resolve to their DS tokens. The format and size
selects share one rule. The refactor/ import stays only for
%input-element, which the suffix input keeps until the text inputs
group moves it.

The mixed bar and the suffix input take body-small (line height 1.4
to 1.3). The visual test shows 0 px against the previous commit; the
mixed bar is not in it, because the test file cannot reach that state.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
Eva Marco 2026-11-26 09:40:55 +01:00 committed by GitHub
parent 284ffbc391
commit 9977a4fbc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 106 additions and 32 deletions

View File

@ -1128,6 +1128,75 @@ test.describe("Selected colors", () => {
});
});
test.describe("Export menu controls", () => {
test("Shows the export button at rest, on hover and exporting", async ({
page,
}) => {
const workspace = new WorkspacePage(page);
await workspace.setupEmptyFile();
await workspace.mockRPC(/get\-file\?/, "workspace/get-file-9066.json");
// The export never answers, so the button stays in "Exporting…".
await page.route(/\/api\/export$/, () => {});
await workspace.goToWorkspace({
fileId: "e179d9df-de35-80bf-8005-283bbd5516b0",
pageId: "e179d9df-de35-80bf-8005-283bbd5516b1",
});
await workspace.clickLeafLayer("Board");
await workspace.rightSidebar
.getByRole("button", { name: "Add export" })
.click();
const button = workspace.rightSidebar.getByRole("button", {
name: /^Export(ing| 1 element)/,
});
await expect(button).toBeVisible();
await page.mouse.move(0, 0);
await expect(button).toHaveScreenshot("export-button-rest.png", {
maxDiffPixelRatio: 0,
threshold: 0,
});
await button.hover();
await expect(button).toHaveScreenshot("export-button-hover.png", {
maxDiffPixelRatio: 0,
threshold: 0,
});
await button.click();
await expect(button).toHaveText("Exporting…");
await page.mouse.move(0, 0);
await expect(button).toHaveScreenshot("export-button-exporting.png", {
maxDiffPixelRatio: 0,
threshold: 0,
});
});
test("Shows the export row", async ({ page }) => {
const workspace = new WorkspacePage(page);
await workspace.setupEmptyFile();
await workspace.mockRPC(/get\-file\?/, "workspace/get-file-9066.json");
await workspace.goToWorkspace({
fileId: "e179d9df-de35-80bf-8005-283bbd5516b0",
pageId: "e179d9df-de35-80bf-8005-283bbd5516b1",
});
await workspace.clickLeafLayer("Board");
await workspace.rightSidebar
.getByRole("button", { name: "Add export" })
.click();
const row = workspace.rightSidebar.locator(
"[class*='menus_exports__element-group']",
);
await expect(row).toBeVisible();
await page.mouse.move(0, 0);
await expect(row).toHaveScreenshot("export-row.png", {
maxDiffPixelRatio: 0,
threshold: 0,
});
});
});
test.describe("Imported SVG attributes", () => {
test("Shows the attributes of an imported SVG shape", async ({ page }) => {
const workspace = new WorkspacePage(page);

View File

@ -14,6 +14,7 @@
[app.main.store :as st]
[app.main.ui.components.select :refer [select]]
[app.main.ui.components.title-bar :refer [title-bar*]]
[app.main.ui.ds.buttons.button :refer [button*]]
[app.main.ui.ds.buttons.icon-button :refer [icon-button*]]
[app.main.ui.ds.foundations.assets.icon :as i]
[app.main.ui.exports.assets]
@ -267,12 +268,10 @@
:icon i/remove}]])])
(when (or (= :multiple exports) (seq exports))
[:button
{:on-click (when-not in-progress? on-download)
:class (stl/css-case
:export-btn true
:btn-disabled in-progress?)
:disabled in-progress?}
[:> button* {:variant "secondary"
:class (stl/css :export-btn)
:on-click (when-not in-progress? on-download)
:disabled in-progress?}
(if in-progress?
(tr "workspace.options.exporting-object")
(tr "workspace.options.export-object" (c (count shapes-with-exports))))])

View File

@ -4,6 +4,13 @@
//
// Copyright (c) KALEIDOS SUBSIDIARY SL
@use "ds/_borders.scss" as *;
@use "ds/_sizes.scss" as *;
@use "ds/_utils.scss" as *;
@use "ds/typography.scss" as *;
// Only for %input-element: the suffix input moves to the DS with the text
// inputs group.
@use "refactor/common-refactor.scss" as deprecated;
@use "../../../sidebar/common/sidebar.scss" as sidebar;
@ -16,7 +23,7 @@
}
.title-spacing-export {
padding-left: deprecated.$s-2;
padding-inline-start: px2rem(2);
margin: 0;
}
@ -27,16 +34,28 @@
}
.multiple-exports {
@include deprecated.flex-row;
display: flex;
align-items: center;
gap: var(--sp-xs);
grid-column: 1 / span 9;
.label {
@extend %mixed-bar;
@include use-typography("body-small");
display: flex;
align-items: center;
flex-grow: 1;
border-radius: $br-8;
block-size: $sz-32;
padding: var(--sp-s);
background-color: var(--color-background-tertiary);
color: var(--color-foreground-primary);
}
.actions {
@include deprecated.flex-row;
display: flex;
align-items: center;
gap: var(--sp-xs);
}
}
@ -52,39 +71,26 @@
grid-template-columns: subgrid;
}
.format-select {
grid-column: span 2;
padding: 0;
.dropdown-upwards {
bottom: deprecated.$s-36;
width: deprecated.$s-80;
top: unset;
}
}
.format-select,
.size-select {
grid-column: span 2;
padding: 0;
.dropdown-upwards {
bottom: deprecated.$s-36;
top: unset;
width: deprecated.$s-80;
inset-block-start: unset;
inset-block-end: px2rem(36);
inline-size: px2rem(80);
}
}
.suffix-input {
grid-column: span 3;
@extend %input-element;
@include deprecated.body-small-typography;
@include use-typography("body-small");
grid-column: span 3;
}
.export-btn {
@extend %button-secondary;
@include deprecated.uppercase-title-typography;
grid-column: 1 / span 9;
height: deprecated.$s-32;
justify-content: center;
}