Skip to content

Commit 3e13f54

Browse files
committed
wip
1 parent abb1b30 commit 3e13f54

File tree

1 file changed

+47
-27
lines changed
  • src/components/index-page/what-is-graphql

1 file changed

+47
-27
lines changed

src/components/index-page/what-is-graphql/wires.tsx

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function ClientEdges({
5252
)
5353
}
5454

55-
function ServerEdges({ highlighted }: { highlighted?: number }) {
55+
function ServerEdges({ highlighted }: { highlighted: number[] }) {
5656
const paths = [
5757
"M696 159.5H811.5V75H1176",
5858
"M696 175.5L833.5 175.5V112H1104.5",
@@ -67,18 +67,21 @@ function ServerEdges({ highlighted }: { highlighted?: number }) {
6767

6868
return (
6969
<>
70-
{paths.map((d, index) => (
71-
<path
72-
key={index}
73-
d={d}
74-
stroke={
75-
highlighted === index
76-
? `url(#paint_sr_dark_linear_671_9150)`
77-
: `url(#paint_sr_light_linear_671_9150)`
78-
}
79-
strokeWidth={highlighted === index ? "2" : "1"}
80-
/>
81-
))}
70+
{paths.map((d, index) => {
71+
const isHighlighted = highlighted?.includes(index)
72+
return (
73+
<path
74+
key={index}
75+
d={d}
76+
strokeWidth={isHighlighted ? 2 : 1}
77+
stroke={
78+
isHighlighted
79+
? `url(#${index % 2 ? "paint_sr_pri_highlight_linear_671_9150" : "paint_sr_sec_highlight_linear_671_9150"})`
80+
: "url(#paint_sr_light_linear_671_9150)"
81+
}
82+
/>
83+
)
84+
})}
8285
</>
8386
)
8487
}
@@ -150,37 +153,41 @@ function ClientBoxes({ highlighted }: { highlighted?: number }) {
150153
)
151154
}
152155

153-
function ServerBoxes({ highlighted }: { highlighted?: number }) {
156+
function ServerBoxes({ highlighted }: { highlighted: number[] }) {
154157
/* eslint-disable react/jsx-key */
155158
const boxes = [
156159
["translate(1176, 48)", <LabirynthIcon />],
157160
["translate(1104, 84)", <ServerIcon />],
158161
["translate(1176, 120)", <ModemIcon />],
159162
["translate(1104, 156)", <CloudIcon />],
160-
["translate(1176, 192)", <ServerIcon />],
161-
["translate(1104, 228)", <LabirynthIcon />],
162-
["translate(1176, 264)", <ServerIcon />],
163-
["translate(1104, 300)", <ServerIcon />],
164-
["translate(1176, 336)", <CloudIcon />],
163+
["translate(1176, 192)", <LabirynthIcon />],
164+
["translate(1104, 228)", <ModemIcon />],
165+
["translate(1176, 264)", <CloudIcon />],
166+
["translate(1104, 300)", <CloudIcon />],
167+
["translate(1176, 336)", <ServerIcon />],
165168
] as const
166169
/* eslint-enable react/jsx-key */
167170

168171
return (
169172
<>
170173
{boxes.map(([transform, children], index) => {
171-
const isHighlighted = index === highlighted
174+
const isHighlighted = highlighted.includes(index)
172175
return (
173176
<Box
174177
key={index}
175178
transform={transform}
176179
fill={
177180
isHighlighted
178-
? "hsl(var(--color-neu-300))"
181+
? index % 2
182+
? "hsl(var(--color-pri-lighter))"
183+
: "hsl(var(--color-sec-light))"
179184
: "hsl(var(--color-neu-100))"
180185
}
181186
className={
182187
isHighlighted
183-
? "[&_path]:fill-neu-800 dark:[&_path]:fill-neu-0"
188+
? index % 2
189+
? "[&_path]:fill-pri-darker dark:[&_path]:fill-pri-lighter"
190+
: "[&_path]:fill-sec-darker dark:[&_path]:fill-sec-lighter"
184191
: undefined
185192
}
186193
>
@@ -230,17 +237,30 @@ function SVGDefinitions() {
230237
<stop stopColor="hsl(var(--color-neu-100))" />
231238
<stop offset="1" stopColor="hsl(var(--color-neu-600))" />
232239
</linearGradient>
240+
233241
<linearGradient
234-
id="paint_sr_dark_linear_671_9150"
242+
id="paint_sr_sec_highlight_linear_671_9150"
235243
x1="696"
236244
y1="0"
237245
x2="937.904"
238246
y2="0"
239247
gradientUnits="userSpaceOnUse"
240248
>
241-
<stop stopColor="hsl(var(--color-neu-700))" />
242-
<stop offset="1" stopColor="hsl(var(--color-neu-300))" />
249+
<stop stopColor="hsl(var(--color-sec-dark))" />
250+
<stop offset="1" stopColor="hsl(var(--color-sec-light))" />
243251
</linearGradient>
252+
<linearGradient
253+
id="paint_sr_pri_highlight_linear_671_9150"
254+
x1="696"
255+
y1="0"
256+
x2="937.904"
257+
y2="0"
258+
gradientUnits="userSpaceOnUse"
259+
>
260+
<stop stopColor="hsl(var(--color-pri-dark))" />
261+
<stop offset="1" stopColor="hsl(var(--color-pri-lighter))" />
262+
</linearGradient>
263+
244264
<clipPath id="clip0_671_9150">
245265
<rect x="514" y="113.5" width="220" height="220" rx="8" fill="white" />
246266
</clipPath>
@@ -281,8 +301,8 @@ export function Wires({ className }: { className?: string }) {
281301
>
282302
<ClientEdges highlighted={step === 0 ? 0 : undefined} />
283303
<ClientBoxes highlighted={step === 0 ? 0 : undefined} />
284-
<ServerEdges highlighted={step === 1 ? 0 : undefined} />
285-
<ServerBoxes highlighted={step === 1 ? 0 : undefined} />
304+
<ServerEdges highlighted={step === 1 ? [1, 6] : []} />
305+
<ServerBoxes highlighted={step === 1 ? [1, 6] : []} />
286306
<SVGDefinitions />
287307
</svg>
288308
<QueryMdx components={components} />

0 commit comments

Comments
 (0)