Skip to content

Commit 5a86de2

Browse files
BillLeoutsakosvl346Bill Leoutsakos
andauthored
improvement(ui): reuse Button treatments for canvas actions (#8155)
Co-authored-by: Bill Leoutsakos <billleoutsakos@Bills-MacBook-Pro.local>
1 parent f1b915b commit 5a86de2

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-controls/canvas-control-button.tsx‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
import { type ComponentProps, forwardRef } from 'react'
2-
import { Button, chipHoverSurfaceClass, cn } from '@sim/emcn'
2+
import { Button } from '@sim/emcn'
33

44
interface CanvasControlButtonProps
55
extends Omit<
66
ComponentProps<typeof Button>,
7-
'variant' | 'size' | 'iconSize' | 'iconPadding' | 'className'
7+
'variant' | 'size' | 'iconSize' | 'iconPadding' | 'shape' | 'className'
88
> {
99
active?: boolean
1010
'aria-label': string
1111
}
1212

13-
/** Fixed-size action in the canvas navigation toolbar. */
1413
export const CanvasControlButton = forwardRef<HTMLButtonElement, CanvasControlButtonProps>(
1514
({ active = false, ...props }, ref) => (
16-
<Button
17-
{...props}
18-
ref={ref}
19-
variant={active ? 'active' : 'ghost'}
20-
className={cn('size-[28px] rounded-sm p-0', !active && chipHoverSurfaceClass)}
21-
/>
15+
<Button {...props} ref={ref} variant={active ? 'active' : 'quiet'} iconSize='regular' />
2216
)
2317
)
2418

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-controls/workflow-controls.tsx‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Button,
66
ChevronDown,
77
Cursor,
8-
chipHoverSurfaceClass,
98
cn,
109
disclosureChevronClass,
1110
Hand,
@@ -101,7 +100,7 @@ export const WorkflowControls = memo(function WorkflowControls() {
101100
* CONTENT_WINDOW_GAP; these controls measure from the canvas floor and
102101
* wall, so they take the 12 directly.
103102
*/
104-
className='absolute bottom-3 left-3 z-10 flex h-[36px] items-center gap-0.5 rounded-lg border border-[var(--border)] bg-[var(--surface-2)] p-1'
103+
className='absolute bottom-3 left-3 z-10 flex h-9 items-center gap-0.5 rounded-lg border border-[var(--border)] bg-[var(--surface-2)] p-1'
105104
onContextMenu={handleContextMenu}
106105
>
107106
{/* Canvas Mode Selector */}
@@ -118,11 +117,7 @@ export const WorkflowControls = memo(function WorkflowControls() {
118117
)}
119118
</CanvasControlButton>
120119
</Tooltip.Trigger>
121-
<Button
122-
aria-label='Change canvas mode'
123-
variant='ghost'
124-
className={cn('size-[20px] rounded-sm p-0', chipHoverSurfaceClass)}
125-
>
120+
<Button aria-label='Change canvas mode' variant='quiet' size='icon'>
126121
<ChevronDown
127122
className={cn(disclosureChevronClass, isCanvasModeOpen && 'rotate-180')}
128123
/>

0 commit comments

Comments
 (0)