From 55c6d689efc1ddb7a53b014792251705c717ae24 Mon Sep 17 00:00:00 2001 From: Brandon Corfman Date: Tue, 9 Jun 2026 20:38:41 -0400 Subject: [PATCH] Change Layout popup button styling --- src/editor/CanvasOverlay.tsx | 35 ++++++++-------- src/editor/LayoutPopoverContent.tsx | 36 ++++++++--------- tests/e2e/layout-popover.spec.ts | 2 + tests/editor/layout-popover-content.test.tsx | 42 +++++++++++++++++++- 4 files changed, 79 insertions(+), 36 deletions(-) diff --git a/src/editor/CanvasOverlay.tsx b/src/editor/CanvasOverlay.tsx index ee5a6b81..700d7585 100644 --- a/src/editor/CanvasOverlay.tsx +++ b/src/editor/CanvasOverlay.tsx @@ -38,6 +38,7 @@ export function CanvasOverlay({ gridSnapEnabled }: { gridSnapEnabled: boolean }) const [layoutSpacingY, setLayoutSpacingY] = useState('1'); const [layoutSetX, setLayoutSetX] = useState(''); const [layoutSetY, setLayoutSetY] = useState(''); + const layoutActionButtonClassName = 'button button-compact'; const [groupPromptOpen, setGroupPromptOpen] = useState(false); const [groupPromptPosition, setGroupPromptPosition] = useState<{ x: number; y: number } | null>(null); const [groupPromptPopupSize, setGroupPromptPopupSize] = useState(null); @@ -678,8 +679,8 @@ export function CanvasOverlay({ gridSnapEnabled }: { gridSnapEnabled: boolean })
Arrange items
- - + +
Spacing
@@ -691,7 +692,7 @@ export function CanvasOverlay({ gridSnapEnabled }: { gridSnapEnabled: boolean }) Spacing X setLayoutSpacingX(e.target.value)} /> -
- - - - - - - -
@@ -765,19 +766,19 @@ export function CanvasOverlay({ gridSnapEnabled }: { gridSnapEnabled: boolean })
Advanced
- - - - diff --git a/src/editor/LayoutPopoverContent.tsx b/src/editor/LayoutPopoverContent.tsx index e3b09f7e..a1c5c9e0 100644 --- a/src/editor/LayoutPopoverContent.tsx +++ b/src/editor/LayoutPopoverContent.tsx @@ -71,6 +71,7 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) { onMatchTopEdges, onClose, } = props; + const actionButtonClassName = 'button button-compact'; return (
@@ -89,10 +90,10 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) {
- -
@@ -130,10 +131,10 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) {
- -
@@ -156,13 +157,13 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) {
- - -
@@ -176,22 +177,22 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) {
- - - - - -
@@ -205,16 +206,16 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) {
- - - -
@@ -228,4 +229,3 @@ export function LayoutPopoverContent(props: LayoutPopoverContentProps) { ); } - diff --git a/tests/e2e/layout-popover.spec.ts b/tests/e2e/layout-popover.spec.ts index cdcf6c59..f6f8b51a 100644 --- a/tests/e2e/layout-popover.spec.ts +++ b/tests/e2e/layout-popover.spec.ts @@ -17,6 +17,8 @@ test('Layout popover applies fixed spacing by centers @critical', async ({ page const layoutButton = page.getByTestId('canvas-layout-button'); await layoutButton.focus(); await layoutButton.press('Enter'); + await expect(page.getByTestId('layout-distribute-x')).toHaveClass(/button/); + await expect(page.getByTestId('layout-apply-spacing-x')).toHaveClass(/button/); await page.getByTestId('layout-units-pixels').click(); await page.getByTestId('layout-spacing-x').fill('64'); await page.getByTestId('layout-apply-spacing-x').click(); diff --git a/tests/editor/layout-popover-content.test.tsx b/tests/editor/layout-popover-content.test.tsx index da34c667..6739e209 100644 --- a/tests/editor/layout-popover-content.test.tsx +++ b/tests/editor/layout-popover-content.test.tsx @@ -63,5 +63,45 @@ describe('LayoutPopoverContent', () => { expect(markup).toContain('data-testid="layout-match-top-edges"'); expect(markup).toContain('data-testid="layout-close"'); }); -}); + it('renders layout actions with button styling instead of label-like menu styling', () => { + const markup = renderToStaticMarkup( + {}} + layoutSpacingX="64" + setLayoutSpacingX={() => {}} + layoutSpacingY="32" + setLayoutSpacingY={() => {}} + layoutSetX="0" + setLayoutSetX={() => {}} + layoutSetY="0" + setLayoutSetY={() => {}} + onDistributeX={() => {}} + onDistributeY={() => {}} + onApplySpacingX={() => {}} + onApplySpacingY={() => {}} + onApplySetX={() => {}} + onApplySetY={() => {}} + onApplySetXY={() => {}} + onAlignLeft={() => {}} + onAlignCenterX={() => {}} + onAlignRight={() => {}} + onAlignTop={() => {}} + onAlignCenterY={() => {}} + onAlignBottom={() => {}} + onStackCenterX={() => {}} + onStackCenterY={() => {}} + onMatchLeftEdges={() => {}} + onMatchTopEdges={() => {}} + onClose={() => {}} + /> + ); + + expect(markup).toContain('class="button button-compact" data-testid="layout-distribute-x"'); + expect(markup).toContain('class="button button-compact" data-testid="layout-apply-spacing-x"'); + expect(markup).toContain('class="button button-compact" data-testid="layout-apply-set-xy"'); + expect(markup).toContain('class="button button-compact" data-testid="layout-align-center-x"'); + expect(markup).toContain('class="button button-compact" data-testid="layout-match-top-edges"'); + }); +});