Skip to content

Commit c13a2ef

Browse files
Oba-Oneclaude
andcommitted
fix(shared,admin): ship Workbench edge/elevation/hover styling via admin CSS
WorkbenchRow (Hub) + WorkbenchCard (Actions) authored a few edge / elevation / hover / selected utilities as arbitrary-value or compound-variant Tailwind classes in shared JSX, which admin's Tailwind v4 content scan does not reach — so they silently no-op in admin's build (confirmed via admin dist-grep). Move the genuinely-missing ones into named classes in admin/index.css (both components are admin-only consumers) and keep the already-shipping utilities. Migrated (were absent from admin dist): - hover lift + hover/active box-shadow (hover:-translate-y-0.5, hover:shadow-[edge-hover,elev-N], active:shadow-[edge-rest]) - selected-row container tint (bg-[rgb(tone-primary-container/0.12)]; the focus ring shadow-[edge-focus] already ships) - inner tile edge+elevation (shadow-[edge-rest,elev-1] -> .workbench-raised) - trailing-arrow mobile hide (max-[599px]:hidden -> .workbench-row-trailing) - transition owned in CSS so transform never races Tailwind translate utils Left untouched (verified shipping): shadow-[edge-rest], shadow-[edge-focus], grid-cols arbitraries, w-[3.75rem], max-[599px]:w-12/h-11/w-11, hover:bg-bg-weak, focus-visible:*. Named rules and glass-raised share @layer utilities, so the 0,2,0 hover/selected overrides win by specificity. Follow-up to the PR #562 review (the deferred WorkbenchCard/Row migration). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 84ca23d commit c13a2ef

3 files changed

Lines changed: 72 additions & 11 deletions

File tree

packages/admin/src/index.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,67 @@
12511251
background: rgb(var(--bg-sub-300));
12521252
}
12531253

1254+
/* ── Workbench surfaces (Hub WorkbenchRow + Actions WorkbenchCard) ──────────
1255+
These shared Canvas components are admin-only consumers. A handful of their
1256+
edge/elevation/hover/selected utilities are authored in packages/shared/src
1257+
JSX as arbitrary-value or compound variants that admin's Tailwind v4 content
1258+
scan does not reach, so they silently no-op in admin's build. Own those here
1259+
(base layout/colour utilities that DO ship stay in the components).
1260+
Verified against admin dist (packages/admin/dist/assets/*.css). */
1261+
.workbench-row,
1262+
.workbench-card {
1263+
transition-property: background-color, transform, box-shadow, filter;
1264+
transition-duration: var(--spring-spatial-fast-duration, 200ms);
1265+
transition-timing-function: var(--spring-spatial-fast-easing, cubic-bezier(0.34, 1.56, 0.64, 1));
1266+
}
1267+
1268+
@media (prefers-reduced-motion: reduce) {
1269+
.workbench-row,
1270+
.workbench-card {
1271+
transition: none;
1272+
}
1273+
}
1274+
1275+
/* Selected row gains a container tint; the focus ring ships via Tailwind. */
1276+
.workbench-row[data-selected="true"] {
1277+
background-color: rgb(var(--tone-primary-container) / 0.12);
1278+
}
1279+
1280+
/* Clickable surfaces lift on hover (row → elevation-1, card → elevation-2)
1281+
and settle on press. Transform is owned here so it never races Tailwind's
1282+
translate utilities. */
1283+
.workbench-row-clickable:hover {
1284+
transform: translateY(-0.125rem);
1285+
box-shadow: var(--edge-hover), var(--elevation-1);
1286+
}
1287+
1288+
.workbench-card-clickable:hover {
1289+
transform: translateY(-0.125rem);
1290+
box-shadow: var(--edge-hover), var(--elevation-2);
1291+
}
1292+
1293+
.workbench-row-clickable:active,
1294+
.workbench-card-clickable:active {
1295+
transform: translateY(0);
1296+
box-shadow: var(--edge-rest);
1297+
}
1298+
1299+
/* Raised inner tiles (thumbnail / icon) — edge ring + elevation. */
1300+
.workbench-raised {
1301+
box-shadow: var(--edge-rest), var(--elevation-1);
1302+
}
1303+
1304+
/* Row trailing affordance hides on the <600px two-column layout. */
1305+
.workbench-row-trailing {
1306+
display: inline-flex;
1307+
}
1308+
1309+
@media (max-width: 599px) {
1310+
.workbench-row-trailing {
1311+
display: none;
1312+
}
1313+
}
1314+
12541315
@supports not (backdrop-filter: blur(1px)) {
12551316
.canvas-route-card {
12561317
background: rgb(var(--admin-surface-0));

packages/shared/src/components/Canvas/WorkbenchCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ export function WorkbenchCard({
4848
alt=""
4949
loading="lazy"
5050
draggable={false}
51-
className="h-11 w-11 rounded-xl object-cover shadow-[var(--edge-rest),_var(--elevation-1)]"
51+
className="h-11 w-11 rounded-xl object-cover workbench-raised"
5252
/>
5353
) : (
5454
<div
55-
className="inline-flex h-11 w-11 items-center justify-center rounded-xl text-primary-base shadow-[var(--edge-rest),_var(--elevation-1)]"
55+
className="inline-flex h-11 w-11 items-center justify-center rounded-xl text-primary-base workbench-raised"
5656
style={{ background: "var(--admin-workbench-icon-bg, rgb(var(--bg-soft-200)))" }}
5757
>
5858
<LeadingIcon className="h-5 w-5" />
@@ -93,13 +93,13 @@ export function WorkbenchCard({
9393
);
9494

9595
const sharedClassName = cn(
96-
"relative flex h-full flex-col gap-3 rounded-2xl p-4 text-left transition-[background-color,transform,box-shadow] duration-[var(--spring-spatial-fast-duration)] ease-[var(--spring-spatial-fast-easing)] motion-reduce:transition-none",
97-
"glass-raised shadow-[var(--edge-rest),_var(--elevation-1)]",
96+
"workbench-card relative flex h-full flex-col gap-3 rounded-2xl p-4 text-left",
97+
"glass-raised",
9898
selected && "shadow-[var(--edge-focus)]",
9999
disabled && "cursor-default opacity-60 shadow-none",
100100
onClick &&
101101
!disabled &&
102-
"cursor-pointer hover:-translate-y-0.5 hover:bg-bg-weak hover:shadow-[var(--edge-hover),_var(--elevation-2)] active:translate-y-0 active:shadow-[var(--edge-rest)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-base",
102+
"workbench-card-clickable cursor-pointer hover:bg-bg-weak focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-base",
103103
className
104104
);
105105

packages/shared/src/components/Canvas/WorkbenchRow.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export function WorkbenchRow({
5656
alt=""
5757
loading="lazy"
5858
draggable={false}
59-
className="h-14 w-14 rounded-2xl object-cover shadow-[var(--edge-rest),_var(--elevation-1)] max-[599px]:h-11 max-[599px]:w-11 max-[599px]:rounded-xl"
59+
className="h-14 w-14 rounded-2xl object-cover workbench-raised max-[599px]:h-11 max-[599px]:w-11"
6060
/>
6161
) : (
6262
<div
63-
className="inline-flex h-14 w-14 items-center justify-center rounded-2xl text-primary-base shadow-[var(--edge-rest),_var(--elevation-1)] max-[599px]:h-11 max-[599px]:w-11 max-[599px]:rounded-xl"
63+
className="inline-flex h-14 w-14 items-center justify-center rounded-2xl text-primary-base workbench-raised max-[599px]:h-11 max-[599px]:w-11"
6464
style={{ background: "var(--admin-workbench-icon-bg, rgb(var(--bg-soft-200)))" }}
6565
>
6666
<LeadingIcon className="h-5 w-5" />
@@ -95,7 +95,7 @@ export function WorkbenchRow({
9595
</div>
9696

9797
<div
98-
className="inline-flex h-9 w-9 items-center justify-center rounded-full bg-bg-soft text-text-sub shadow-[var(--edge-rest)] max-[599px]:hidden"
98+
className="workbench-row-trailing h-9 w-9 items-center justify-center rounded-full bg-bg-soft text-text-sub shadow-[var(--edge-rest)]"
9999
aria-hidden="true"
100100
>
101101
<RiArrowRightLine className="h-4 w-4" />
@@ -104,13 +104,13 @@ export function WorkbenchRow({
104104
);
105105

106106
const sharedClassName = cn(
107-
"relative grid w-full items-center gap-3 px-4 py-3 text-left transition-[background-color,transform,box-shadow,filter] duration-[var(--spring-spatial-fast-duration)] ease-[var(--spring-spatial-fast-easing)] motion-reduce:transition-none max-[599px]:grid-cols-[auto_minmax(0,1fr)]",
107+
"workbench-row relative grid w-full items-center gap-3 px-4 py-3 text-left max-[599px]:grid-cols-[auto_minmax(0,1fr)]",
108108
"grid-cols-[auto_minmax(0,1fr)_auto]",
109-
selected && "bg-[rgb(var(--tone-primary-container)/0.12)] shadow-[var(--edge-focus)]",
109+
selected && "shadow-[var(--edge-focus)]",
110110
disabled && "cursor-default opacity-60 shadow-none",
111111
onClick &&
112112
!disabled &&
113-
"workbench-row-clickable cursor-pointer hover:-translate-y-0.5 hover:bg-bg-weak hover:shadow-[var(--edge-hover),_var(--elevation-1)] active:translate-y-0 active:bg-bg-soft active:shadow-[var(--edge-rest)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-base",
113+
"workbench-row-clickable cursor-pointer hover:bg-bg-weak focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-base",
114114
className
115115
);
116116

0 commit comments

Comments
 (0)