Skip to content

Commit 4d6d07c

Browse files
committed
fix diagrams
1 parent 7fd85f7 commit 4d6d07c

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

components/sections/architecture.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ export function Architecture() {
2929
{diagrams.map((item) => (
3030
<div key={item.title} className="rounded-xl border border-white/10 bg-base-bg/60 p-5">
3131
<h3 className="text-xl font-semibold text-base-text font-display mb-4">{item.title}</h3>
32-
<div className="flex items-center justify-center gap-2 flex-wrap">
32+
<div className="flex flex-col items-center gap-2">
3333
{item.flow.map((label, idx) => (
34-
<div key={label} className="flex items-center gap-2">
34+
<div key={`v-${label}`} className="flex flex-col items-center gap-2">
3535
<DiagramBlock label={label} accent={item.accent[idx] === 'blue' ? 'blue' : 'mint'} />
36-
{idx < item.flow.length - 1 && <DiagramArrow from={label} to={item.flow[idx + 1]} />}
36+
{idx < item.flow.length - 1 && (
37+
<DiagramArrow from={label} to={item.flow[idx + 1]} orientation="vertical" />
38+
)}
3739
</div>
3840
))}
3941
</div>

lib/diagrams/blocks.tsx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@ export function DiagramBlock({ label, accent = 'mint' }: BlockProps) {
88
const stroke = '#1b2237';
99
return (
1010
<svg width="180" height="72" viewBox="0 0 180 72" role="img" aria-label={label}>
11-
<rect
12-
x="4"
13-
y="4"
14-
width="172"
15-
height="64"
16-
rx="12"
17-
fill="rgba(255,255,255,0.04)"
18-
stroke={stroke}
19-
strokeWidth="2"
20-
/>
11+
<rect x="5" y="4" width="170" height="64" rx="12" fill="rgba(255,255,255,0.04)" stroke={stroke} strokeWidth="2" />
2112
<text
2213
x="90"
2314
y="40"
2415
textAnchor="middle"
2516
fontFamily="var(--font-display, 'Space Grotesk', sans-serif)"
26-
fontSize="14"
17+
fontSize="12"
2718
fontWeight="600"
2819
fill={fill}
2920
>
@@ -36,12 +27,35 @@ export function DiagramBlock({ label, accent = 'mint' }: BlockProps) {
3627
type ArrowProps = {
3728
from?: string;
3829
to?: string;
30+
orientation?: 'horizontal' | 'vertical';
31+
className?: string;
3932
};
4033

41-
export function DiagramArrow({ from, to }: ArrowProps) {
34+
export function DiagramArrow({ from, to, orientation = 'horizontal', className }: ArrowProps) {
4235
const label = [from, to].filter(Boolean).join(' → ');
36+
if (orientation === 'vertical') {
37+
return (
38+
<svg className={className} width="72" height="60" viewBox="0 0 72 60" role="img" aria-label={label}>
39+
<defs>
40+
<marker id="arrowhead-vert" markerWidth="8" markerHeight="8" refX="4" refY="4" orient="auto">
41+
<polygon points="0 0, 8 4, 0 8" fill="#7aa2ff" />
42+
</marker>
43+
</defs>
44+
<line
45+
x1="36"
46+
y1="10"
47+
x2="36"
48+
y2="48"
49+
stroke="#7aa2ff"
50+
strokeWidth="3"
51+
markerEnd="url(#arrowhead-vert)"
52+
/>
53+
</svg>
54+
);
55+
}
56+
4357
return (
44-
<svg width="60" height="72" viewBox="0 0 60 72" role="img" aria-label={label}>
58+
<svg className={className} width="60" height="72" viewBox="0 0 60 72" role="img" aria-label={label}>
4559
<defs>
4660
<marker id="arrowhead" markerWidth="8" markerHeight="8" refX="4" refY="4" orient="auto">
4761
<polygon points="0 0, 8 4, 0 8" fill="#7aa2ff" />

0 commit comments

Comments
 (0)