diff --git a/frontend/playwright/ui/visual-specs/workspace.spec.js b/frontend/playwright/ui/visual-specs/workspace.spec.js index bc3f1544ed..7aef87e747 100644 --- a/frontend/playwright/ui/visual-specs/workspace.spec.js +++ b/frontend/playwright/ui/visual-specs/workspace.spec.js @@ -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); diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs index 4dd5a2c761..559434293a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs @@ -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))))]) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.scss b/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.scss index 92aa2ab196..0ce60aa681 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.scss @@ -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; }