|
| 1 | +import { cn } from '@sim/emcn' |
1 | 2 | import { EmptyState } from '@/components/empty-state/empty-state' |
2 | | -import { |
3 | | - Bar, |
4 | | - Vignette, |
5 | | -} from '@/app/workspace/[workspaceId]/components/resource/components/resource-empty-state/vignette' |
6 | 3 |
|
7 | | -/** Cell fill widths per column, row by row — varied so the grid reads as data, not a lattice. */ |
| 4 | +/** |
| 5 | + * Neutral ink at graded strengths. |
| 6 | + * |
| 7 | + * `--surface-4`/`--surface-5` are near-white in light mode (`#f5f5f5`/`#f3f3f3`), |
| 8 | + * so skeleton geometry built on them dissolves on a white card. Mixing |
| 9 | + * `--text-secondary` into transparent instead gives a real mid-grey that inverts |
| 10 | + * with the theme — the same idiom the workflow editor's empty state uses for the |
| 11 | + * one bar it needs you to actually see. |
| 12 | + */ |
| 13 | +const INK = { |
| 14 | + header: 'color-mix(in srgb, var(--text-secondary) 32%, transparent)', |
| 15 | + headerType: 'color-mix(in srgb, var(--text-secondary) 26%, transparent)', |
| 16 | + cell: 'color-mix(in srgb, var(--text-secondary) 17%, transparent)', |
| 17 | + selection: 'color-mix(in srgb, var(--text-secondary) 30%, transparent)', |
| 18 | +} as const |
| 19 | + |
| 20 | +const COLUMN_TEMPLATE = '84px 66px 66px 66px' |
| 21 | + |
| 22 | +/** Header label widths, then per-row cell widths — varied so the grid reads as data. */ |
| 23 | +const HEADER_WIDTHS = [34, 26, 24, 26] as const |
| 24 | + |
8 | 25 | const CELL_WIDTHS = [ |
9 | | - [58, 40, 30, 44], |
10 | | - [48, 34, 36, 38], |
11 | | - [64, 44, 26, 46], |
12 | | - [42, 30, 34, 36], |
| 26 | + [52, 34, 26, 38], |
| 27 | + [44, 30, 32, 30], |
| 28 | + [58, 38, 22, 40], |
| 29 | + [38, 26, 30, 32], |
13 | 30 | ] as const |
14 | 31 |
|
15 | | -const COLUMN_TEMPLATE = '92px 76px 76px 76px' |
16 | | - |
17 | 32 | /** |
18 | | - * A sheet of cells running off the right and bottom edges, with one cell held in |
19 | | - * an edit ring — a table is the only resource whose structure *is* its picture. |
| 33 | + * A crisp table card whose columns run past its right edge. |
| 34 | + * |
| 35 | + * The workflow editor's vignette keeps its block fully opaque and fades only the |
| 36 | + * connector strokes leaving the frame; masking the whole composition is what |
| 37 | + * makes a miniature look washed rather than deliberate. So the card here stays |
| 38 | + * sharp and the continuation is drawn the way a real table draws it — an |
| 39 | + * overflow fade at the edge the columns run off. |
20 | 40 | */ |
21 | 41 | function TablesGraphic() { |
22 | 42 | return ( |
23 | | - <Vignette> |
24 | | - <div |
25 | | - className='absolute top-[16px] left-[30px] grid w-[320px] overflow-hidden rounded-tl-[8px] border-[var(--border-1)] border-t border-l' |
26 | | - style={{ gridTemplateColumns: COLUMN_TEMPLATE }} |
27 | | - > |
28 | | - {[0, 1, 2, 3].map((column) => ( |
| 43 | + <div aria-hidden='true' className='relative h-[148px] w-[320px]'> |
| 44 | + <div className='absolute top-[16px] left-[34px] h-[116px] w-[252px] overflow-hidden rounded-[8px] border border-[var(--border-1)] bg-[var(--surface-2)]'> |
| 45 | + <div |
| 46 | + className='grid border-[var(--border-1)] border-b bg-[var(--surface-3)]' |
| 47 | + style={{ gridTemplateColumns: COLUMN_TEMPLATE }} |
| 48 | + > |
| 49 | + {HEADER_WIDTHS.map((width, column) => ( |
| 50 | + <div |
| 51 | + key={`header-${column}`} |
| 52 | + className='flex h-[28px] items-center gap-[6px] border-[var(--border-1)] border-r px-2.5' |
| 53 | + > |
| 54 | + <span |
| 55 | + className='size-[7px] shrink-0 rounded-[2px]' |
| 56 | + style={{ background: INK.headerType }} |
| 57 | + /> |
| 58 | + <span |
| 59 | + className='block h-[6px] rounded-full' |
| 60 | + style={{ width, background: INK.header }} |
| 61 | + /> |
| 62 | + </div> |
| 63 | + ))} |
| 64 | + </div> |
| 65 | + |
| 66 | + {CELL_WIDTHS.map((row, rowIndex) => ( |
29 | 67 | <div |
30 | | - key={`header-${column}`} |
31 | | - className='flex h-[26px] items-center gap-[6px] border-[var(--border-1)] border-r border-b bg-[var(--surface-3)] px-2.5' |
| 68 | + key={`row-${rowIndex}`} |
| 69 | + className={cn( |
| 70 | + 'grid', |
| 71 | + rowIndex < CELL_WIDTHS.length - 1 && 'border-[var(--border-1)] border-b' |
| 72 | + )} |
| 73 | + style={{ gridTemplateColumns: COLUMN_TEMPLATE }} |
32 | 74 | > |
33 | | - <span className='size-[8px] shrink-0 rounded-[2px] bg-[var(--surface-6)]' /> |
34 | | - <Bar |
35 | | - className='h-[7px] bg-[var(--surface-6)]' |
36 | | - style={{ width: column === 0 ? 44 : 32 }} |
37 | | - /> |
38 | | - </div> |
39 | | - ))} |
40 | | - |
41 | | - {CELL_WIDTHS.map((row, rowIndex) => |
42 | | - row.map((width, column) => { |
43 | | - const isEditing = rowIndex === 1 && column === 1 |
44 | | - return ( |
| 75 | + {row.map((width, column) => ( |
45 | 76 | <div |
46 | 77 | key={`cell-${rowIndex}-${column}`} |
47 | | - className='relative flex h-[26px] items-center border-[var(--border-1)] border-r border-b bg-[var(--surface-1)] px-2.5' |
| 78 | + className='relative flex h-[22px] items-center border-[var(--border-1)] border-r px-2.5' |
48 | 79 | > |
49 | | - <Bar className='h-2' style={{ width }} /> |
50 | | - {isEditing ? ( |
51 | | - <span className='absolute inset-[-1px] rounded-[3px] border-[1.5px] border-[var(--brand-secondary)]' /> |
| 80 | + <span |
| 81 | + className='block h-[6px] rounded-full' |
| 82 | + style={{ width, background: INK.cell }} |
| 83 | + /> |
| 84 | + {rowIndex === 1 && column === 1 ? ( |
| 85 | + <span |
| 86 | + className='absolute inset-[-1px] rounded-[3px] border-[1.5px]' |
| 87 | + style={{ borderColor: INK.selection }} |
| 88 | + /> |
52 | 89 | ) : null} |
53 | 90 | </div> |
54 | | - ) |
55 | | - }) |
56 | | - )} |
| 91 | + ))} |
| 92 | + </div> |
| 93 | + ))} |
| 94 | + |
| 95 | + <span className='absolute top-0 right-0 h-[28px] w-[30px] bg-gradient-to-l from-[var(--surface-3)] to-transparent' /> |
| 96 | + <span className='absolute top-[28px] right-0 bottom-0 w-[30px] bg-gradient-to-l from-[var(--surface-2)] to-transparent' /> |
57 | 97 | </div> |
58 | | - </Vignette> |
| 98 | + </div> |
59 | 99 | ) |
60 | 100 | } |
61 | 101 |
|
|
0 commit comments