Skip to content

Commit f1e45e4

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
refactor(emcn): unify overlay action hover styling
1 parent 7a463bc commit f1e45e4

3 files changed

Lines changed: 7 additions & 28 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,6 @@ function PreviewEditorContent({
12391239
<OverlayActionButton
12401240
aria-label={copiedSection === 'input' ? 'Copied' : 'Copy'}
12411241
type='button'
1242-
surface='uniform'
12431242
onClick={(e) => {
12441243
e.stopPropagation()
12451244
handleCopySection(formatValueAsJson(executionData.input), 'input')
@@ -1261,7 +1260,6 @@ function PreviewEditorContent({
12611260
<OverlayActionButton
12621261
aria-label='Search'
12631262
type='button'
1264-
surface='uniform'
12651263
onClick={(e) => {
12661264
e.stopPropagation()
12671265
activateSearch()
@@ -1311,7 +1309,6 @@ function PreviewEditorContent({
13111309
<OverlayActionButton
13121310
aria-label={copiedSection === 'output' ? 'Copied' : 'Copy'}
13131311
type='button'
1314-
surface='uniform'
13151312
onClick={(e) => {
13161313
e.stopPropagation()
13171314
handleCopySection(formatValueAsJson(executionData.output), 'output')
@@ -1333,7 +1330,6 @@ function PreviewEditorContent({
13331330
<OverlayActionButton
13341331
aria-label='Search'
13351332
type='button'
1336-
surface='uniform'
13371333
onClick={(e) => {
13381334
e.stopPropagation()
13391335
activateSearch()

‎packages/emcn/src/components/overlay-action-button/overlay-action-button.test.tsx‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ afterEach(() => {
2424
vi.useRealTimers()
2525
})
2626

27-
/** Pre-migration recipes from log details, the deployment preview and workflow previews. */
27+
/** Pre-migration recipes from log details and the deployment preview. */
2828
const PREVIOUS = [
2929
{
3030
name: 'default 20px adaptive action',
@@ -40,13 +40,6 @@ const PREVIOUS = [
4040
className:
4141
'size-[28px] cursor-pointer bg-transparent p-0 backdrop-blur-xs hover-hover:bg-[var(--surface-3)]',
4242
},
43-
{
44-
name: '20px uniform action',
45-
props: { surface: 'uniform' },
46-
variant: 'ghost',
47-
className:
48-
'size-[20px] cursor-pointer border border-[var(--border-1)] bg-transparent p-0 backdrop-blur-xs hover-hover:bg-[var(--surface-4)]',
49-
},
5043
] as const
5144

5245
describe('OverlayActionButton', () => {

‎packages/emcn/src/components/overlay-action-button/overlay-action-button.tsx‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,43 @@ import { Button, type ButtonProps } from '../button/button'
55

66
/** Transparent, bordered icon action over code or preview content. */
77
export const overlayActionButtonVariants = cva(
8-
'cursor-pointer border border-[var(--border)] bg-transparent p-0 backdrop-blur-xs',
8+
'cursor-pointer border border-[var(--border)] bg-transparent p-0 backdrop-blur-xs hover-hover:bg-[var(--surface-3)] dark:hover-hover:bg-[var(--surface-5)] hover-hover:border-[var(--border)]',
99
{
1010
variants: {
1111
size: {
1212
sm: 'size-[20px]',
1313
md: 'size-[28px]',
1414
},
15-
surface: {
16-
adaptive:
17-
'hover-hover:bg-[var(--surface-3)] dark:hover-hover:bg-[var(--surface-5)] hover-hover:border-[var(--border)]',
18-
uniform: 'hover-hover:bg-[var(--surface-4)]',
19-
},
2015
},
21-
defaultVariants: { size: 'sm', surface: 'adaptive' },
16+
defaultVariants: { size: 'sm' },
2217
}
2318
)
2419

2520
export interface OverlayActionButtonProps
26-
extends Omit<ButtonProps, 'variant' | 'size' | 'iconPadding'> {
21+
extends Omit<ButtonProps, 'variant' | 'size' | 'iconPadding' | 'iconSize'> {
2722
/** Accessible name for the icon action; tooltip content is supplied separately. */
2823
'aria-label': string
2924
/** 20px by default; `md` provides the 28px preview action. */
3025
size?: NonNullable<VariantProps<typeof overlayActionButtonVariants>['size']>
31-
/**
32-
* `adaptive` uses surface-3 on hover in light mode and surface-5 in dark mode.
33-
* `uniform` uses surface-4 on hover in both themes.
34-
* @default 'adaptive'
35-
*/
36-
surface?: NonNullable<VariantProps<typeof overlayActionButtonVariants>['surface']>
3726
}
3827

3928
/**
4029
* Icon action floating over content. Owns geometry, border, blur and hover treatment;
4130
* callers supply positioning, icons, labels and command behavior.
31+
* Hover uses surface-3 in light mode and surface-5 in dark mode.
4232
* Forwards the native button ref and props for tooltip `asChild` composition.
4333
* Native form behavior is inherited from Button; pass `type` when it must be explicit.
4434
*
4535
* @example <OverlayActionButton aria-label='Copy' type='button' onClick={onCopy}><Clipboard className='size-[10px]' /></OverlayActionButton>
4636
*/
4737
export const OverlayActionButton = forwardRef<HTMLButtonElement, OverlayActionButtonProps>(
48-
({ size, surface, className, ...props }, ref) => (
38+
({ size, className, ...props }, ref) => (
4939
<Button
5040
{...props}
5141
ref={ref}
5242
variant='ghost'
5343
size='md'
54-
className={cn(overlayActionButtonVariants({ size, surface }), className)}
44+
className={cn(overlayActionButtonVariants({ size }), className)}
5545
/>
5646
)
5747
)

0 commit comments

Comments
 (0)