Skip to content

Commit bce8234

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
refactor(ui): share resource bulk-action button styles
1 parent 4ad9387 commit bce8234

4 files changed

Lines changed: 17 additions & 20 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { chipFilledFillTokens, chipRadiusClass } from '@sim/emcn'
2+
3+
/** Shared geometry and hover treatment for resource bulk-action buttons. */
4+
export const RESOURCE_ACTION_BUTTON_BASE = `${chipRadiusClass} size-[28px] p-0 hover-hover:bg-[var(--brand-secondary)] hover-hover:text-[var(--text-inverse)]!`
5+
6+
/** Resource and knowledge actions follow the chip fill in both themes. */
7+
export const RESOURCE_ACTION_BUTTON_FILLED = `${chipFilledFillTokens} ${RESOURCE_ACTION_BUTTON_BASE}`

‎apps/sim/app/workspace/[workspaceId]/components/resource/components/action-bar/action-bar.tsx‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import type { ComponentType } from 'react'
44
import {
55
Button,
6-
chipFilledFillTokens,
76
cn,
87
DropdownMenu,
98
DropdownMenuContent,
@@ -15,12 +14,7 @@ import {
1514
import { Download } from '@sim/emcn/icons'
1615
import type { MoveOptionNode } from '@/app/workspace/[workspaceId]/components/folders'
1716
import { renderMoveOptions } from '@/app/workspace/[workspaceId]/components/folders'
18-
19-
/** Shared chrome for every action button, so the bar reads as one control strip. */
20-
const ACTION_BUTTON_CLASS = cn(
21-
chipFilledFillTokens,
22-
'hover-hover:text-[var(--text-inverse)]! size-[28px] rounded-lg p-0 hover-hover:bg-[var(--brand-secondary)]'
23-
)
17+
import { RESOURCE_ACTION_BUTTON_FILLED } from '@/app/workspace/[workspaceId]/components/resource/components/action-bar/action-bar-styles'
2418

2519
interface ActionButtonProps {
2620
icon: ComponentType<{ className?: string }>
@@ -38,7 +32,7 @@ function ActionButton({ icon: Icon, label, onClick, disabled }: ActionButtonProp
3832
variant='ghost'
3933
onClick={onClick}
4034
disabled={disabled}
41-
className={ACTION_BUTTON_CLASS}
35+
className={RESOURCE_ACTION_BUTTON_FILLED}
4236
>
4337
<Icon className='size-[12px]' />
4438
</Button>
@@ -133,7 +127,7 @@ export function ResourceActionBar({
133127
aria-label='Move'
134128
variant='ghost'
135129
disabled={actionsDisabled}
136-
className={ACTION_BUTTON_CLASS}
130+
className={RESOURCE_ACTION_BUTTON_FILLED}
137131
>
138132
<Folder className='size-[12px]' />
139133
</Button>

‎apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/action-bar/action-bar.tsx‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import { Button, chipFilledFillTokens, cn, Tooltip } from '@sim/emcn'
1+
import { Button, cn, Tooltip } from '@sim/emcn'
22
import { Ban, Circle, Trash } from '@sim/emcn/icons'
33
import { domAnimation, LazyMotion, m } from 'framer-motion'
4+
import { RESOURCE_ACTION_BUTTON_FILLED } from '@/app/workspace/[workspaceId]/components/resource/components/action-bar/action-bar-styles'
45
import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
56

6-
/** One source of truth for the button chrome, so the three actions read as one control strip. */
7-
const ACTION_BUTTON_CLASS = cn(
8-
chipFilledFillTokens,
9-
'hover-hover:text-[var(--text-inverse)]! size-[28px] rounded-lg p-0 hover-hover:bg-[var(--brand-secondary)]'
10-
)
11-
127
interface ActionBarProps {
138
selectedCount: number
149
onEnable?: () => void
@@ -97,7 +92,7 @@ export function ActionBar({
9792
aria-label='Enable'
9893
onClick={onEnable}
9994
disabled={isLoading}
100-
className={ACTION_BUTTON_CLASS}
95+
className={RESOURCE_ACTION_BUTTON_FILLED}
10196
>
10297
<Circle className='size-[12px]' />
10398
</Button>
@@ -114,7 +109,7 @@ export function ActionBar({
114109
aria-label='Disable'
115110
onClick={onDisable}
116111
disabled={isLoading}
117-
className={ACTION_BUTTON_CLASS}
112+
className={RESOURCE_ACTION_BUTTON_FILLED}
118113
>
119114
<Ban className='size-[12px]' />
120115
</Button>
@@ -131,7 +126,7 @@ export function ActionBar({
131126
aria-label='Delete'
132127
onClick={onDelete}
133128
disabled={isLoading}
134-
className={ACTION_BUTTON_CLASS}
129+
className={RESOURCE_ACTION_BUTTON_FILLED}
135130
>
136131
<Trash className='size-[12px]' />
137132
</Button>

‎apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-action-bar/table-action-bar.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type React from 'react'
44
import { Button, cn, Tooltip } from '@sim/emcn'
55
import { Eye, PlayOutline, RefreshCw, Square } from '@sim/emcn/icons'
66
import { AnimatePresence, domAnimation, LazyMotion, m } from 'framer-motion'
7+
import { RESOURCE_ACTION_BUTTON_BASE } from '@/app/workspace/[workspaceId]/components/resource/components/action-bar/action-bar-styles'
78

89
interface TableActionBarProps {
910
/** Number of (row × group) cells the run/stop buttons would target. Drives
@@ -157,7 +158,7 @@ function ActionIconButton({ label, onClick, disabled, children }: ActionIconButt
157158
variant='ghost'
158159
onClick={onClick}
159160
disabled={disabled}
160-
className='size-[28px] rounded-lg bg-[var(--surface-5)] p-0 hover-hover:bg-[var(--brand-secondary)] hover-hover:text-[var(--text-inverse)]!'
161+
className={cn(RESOURCE_ACTION_BUTTON_BASE, 'bg-[var(--surface-5)]')}
161162
aria-label={label}
162163
>
163164
{children}

0 commit comments

Comments
 (0)