diff --git a/src/components/index-page/data-colocation/index.tsx b/src/components/index-page/data-colocation/index.tsx index 90514228d9..1f54f51de2 100644 --- a/src/components/index-page/data-colocation/index.tsx +++ b/src/components/index-page/data-colocation/index.tsx @@ -11,6 +11,8 @@ import { import { Pre } from "@/components/pre" import { SectionLabel } from "@/app/conf/_design-system/section-label" import InfoIcon from "@/app/conf/_design-system/pixelarticons/info.svg?svgr" +import { useOnClickOutside } from "@/app/conf/_design-system/utils/useOnClickOutside" +import { isSpanElement } from "@/app/conf/_design-system/utils/isSpanElement" import { ComponentTree } from "./component-tree" import { FriendList } from "./friend-list" @@ -18,8 +20,6 @@ import { FriendList } from "./friend-list" import json from "./data-colocation.json" import Query from "./data-colocation.mdx" import "./data-colocation.css" -import { useOnClickOutside } from "@/app/conf/_design-system/utils/useOnClickOutside" -import { isSpanElement } from "@/app/conf/_design-system/utils/isSpanElement" const highlightedFragments = { GetFriendList: 1, diff --git a/src/components/index-page/what-is-graphql/wires.module.css b/src/components/index-page/what-is-graphql/wires.module.css index ab88c602b3..52b608861f 100644 --- a/src/components/index-page/what-is-graphql/wires.module.css +++ b/src/components/index-page/what-is-graphql/wires.module.css @@ -85,3 +85,12 @@ transform: rotateX(-90deg) translateY(60px) translateZ(150px); } } + +@keyframes query-exit-sm { + from { + transform: rotateY(0deg) translateX(0px) translateZ(150px); + } + to { + transform: rotateY(90deg) translateX(60px) translateZ(150px); + } +} diff --git a/src/components/index-page/what-is-graphql/wires.tsx b/src/components/index-page/what-is-graphql/wires.tsx index ff17025579..963bf4efd3 100644 --- a/src/components/index-page/what-is-graphql/wires.tsx +++ b/src/components/index-page/what-is-graphql/wires.tsx @@ -8,6 +8,7 @@ import { useReducer, useRef, } from "react" +import { throttle } from "@/app/conf/_design-system/utils/throttle" import { Code } from "nextra/components" @@ -27,42 +28,43 @@ import { import QueryMdx from "./api-gateway-query.mdx" import ResponseMdx from "./api-gateway-response.mdx" import styles from "./wires.module.css" -import { throttle } from "@/app/conf/_design-system/utils/throttle" + +const bigScreenClientEdges = [ + "M514.5 220H424.5V76H72", + "M446 220H424.5V112H144", + "M446 220H424.5V147H72", + "M446 220H424.5V184H144", + "M528 220H514.206L72 220", + "M528 220L424.866 220V256H144", + "M446 220L424.5 220V291.75H72", + "M528.5 220H424.5V328H144", + "M528 220H424.772V365H72", +] function ClientEdges({ highlightedEdge, highlightedVisible, + edges, + baseStroke = "url(#paint_lr_light_linear_671_9150)", + highlightedStroke = "url(#paint_lr_dark_linear_671_9150)", }: { highlightedEdge?: number highlightedVisible: boolean + edges: string[] + baseStroke?: string + highlightedStroke?: string }) { - const paths = [ - "M514.5 220H424.5V76H72", - "M446 220H424.5V112H144", - "M446 220H424.5V147H72", - "M446 220H424.5V184H144", - "M528 220H514.206L72 220", - "M528 220L424.866 220V256H144", - "M446 220L424.5 220V291.75H72", - "M528.5 220H424.5V328H144", - "M528 220H424.772V365H72", - ] - return ( <> {moveHighlightedToTop( highlightedEdge, - paths.map((path, index) => ( + edges.map((path, index) => ( - + {highlightedEdge === index && ( @@ -74,45 +76,47 @@ function ClientEdges({ ) } +const bigScreenServerEdges = [ + "M696 159.5H811.5V75H1176", + "M696 175.5L833.5 175.5V112H1104.5", + "M696 191.5H855.5V148.5H1176", + "M696 206.5L876 206.5V184.5H1104", + "M696 220.5H704.5H1176", + "M696 234.5L876 234.5V256.5H1104", + "M696 249.5H855.5V292.5H1176", + "M696 265.5L833.5 265.5V329H1104", + "M696 281.5H811.5V366H1176", +] + function ServerEdges({ highlighted, highlightedVisible, + edges, + baseStroke, + oddStroke, + evenStroke, }: { highlighted: number[] highlightedVisible: boolean + edges: string[] + baseStroke: string + oddStroke: string + evenStroke: string }) { - const paths = [ - "M696 159.5H811.5V75H1176", - "M696 175.5L833.5 175.5V112H1104.5", - "M696 191.5H855.5V148.5H1176", - "M696 206.5L876 206.5V184.5H1104", - "M696 220.5H704.5H1176", - "M696 234.5L876 234.5V256.5H1104", - "M696 249.5H855.5V292.5H1176", - "M696 265.5L833.5 265.5V329H1104", - "M696 281.5H811.5V366H1176", - ] as const - return ( <> - {paths.map((d, index) => { + {edges.map((d, index) => { const isHighlighted = highlighted?.includes(index) return ( - + {isHighlighted && ( )} @@ -137,31 +141,37 @@ function Box({ path]:translate-x-4 [&>path]:translate-y-4 [:where(&>path:not([fill]))]:fill-neu-600", + "fill-neu-100 [&>path]:translate-x-3 [&>path]:translate-y-3 sm:[&>path]:translate-x-4 sm:[&>path]:translate-y-4 [:where(&>path:not([fill]))]:fill-neu-600", className, )} > - + {children} ) } -function ClientBoxes({ highlighted }: { highlighted?: number }) { - /* eslint-disable react/jsx-key */ - const boxes = [ - ["translate(16, 48)", ], - ["translate(88, 84)", ], - ["translate(16, 120)", ], - ["translate(88, 156)", ], - ["translate(16, 192)", ], - ["translate(88, 228)", ], - ["translate(16, 264)", ], - ["translate(88, 300)", ], - ["translate(16, 336)", ], - ] as const - /* eslint-enable react/jsx-key */ +/* eslint-disable react/jsx-key */ +const bigScreenClientBoxes: Array<[string, React.ReactNode]> = [ + ["translate(16, 48)", ], + ["translate(88, 84)", ], + ["translate(16, 120)", ], + ["translate(88, 156)", ], + ["translate(16, 192)", ], + ["translate(88, 228)", ], + ["translate(16, 264)", ], + ["translate(88, 300)", ], + ["translate(16, 336)", ], +] +/* eslint-enable react/jsx-key */ +function ClientBoxes({ + highlighted, + boxes, +}: { + highlighted?: number + boxes: Array<[string, React.ReactNode]> +}) { return ( <> {boxes.map(([transform, children], index) => { @@ -184,21 +194,27 @@ function ClientBoxes({ highlighted }: { highlighted?: number }) { ) } -function ServerBoxes({ highlighted }: { highlighted: number[] }) { - /* eslint-disable react/jsx-key */ - const boxes = [ - ["translate(1176, 48)", ], - ["translate(1104, 84)", ], - ["translate(1176, 120)", ], - ["translate(1104, 156)", ], - ["translate(1176, 192)", ], - ["translate(1104, 228)", ], - ["translate(1176, 264)", ], - ["translate(1104, 300)", ], - ["translate(1176, 336)", ], - ] as const - /* eslint-enable react/jsx-key */ +/* eslint-disable react/jsx-key */ +const bigScreenServerBoxes: Array<[string, React.ReactNode]> = [ + ["translate(1176, 48)", ], + ["translate(1104, 84)", ], + ["translate(1176, 120)", ], + ["translate(1104, 156)", ], + ["translate(1176, 192)", ], + ["translate(1104, 228)", ], + ["translate(1176, 264)", ], + ["translate(1104, 300)", ], + ["translate(1176, 336)", ], +] +/* eslint-enable react/jsx-key */ +function ServerBoxes({ + highlighted, + boxes, +}: { + highlighted: number[] + boxes: Array<[string, React.ReactNode]> +}) { return ( <> {boxes.map(([transform, children], index) => { @@ -463,7 +479,7 @@ const components = {
@@ -478,7 +494,6 @@ export function Wires({ className }: { className?: string }) {
   const [step, inc] = useReducer(x => (x + 1) % STEPS, 0)
 
   const ref = useRef(null)
-  const backgroundRef = useRef(null)
 
   useEffect(() => {
     const animate = document.querySelector(
@@ -486,8 +501,6 @@ export function Wires({ className }: { className?: string }) {
     )
 
     const onAnimationRepeat = () => {
-      // we avoid spinning a second time if the user has just clicked the button
-      if (backgroundRef.current?.disabled) return
       inc()
     }
 
@@ -498,20 +511,6 @@ export function Wires({ className }: { className?: string }) {
     return () => animate?.removeEventListener("repeatEvent", onAnimationRepeat)
   }, [])
 
-  const onBackgroundClick = useMemo(
-    () =>
-      throttle(() => {
-        const button = backgroundRef.current
-        if (!button) return
-        button.disabled = true
-        inc()
-        setTimeout(() => {
-          button.disabled = false
-        }, 750)
-      }, 500),
-    [],
-  )
-
   return (
     
+ - - - 0} /> - 0 ? [1, 6] : []} /> + + + 0} + edges={bigScreenServerEdges} + baseStroke="stroke-[url(#paint_sr_light_linear_671_9150)]" + oddStroke="stroke-[url(#paint_sr_pri_highlight_linear_671_9150)] motion-reduce:stroke-[url(#paint_sr_pri_highlight_linear_static_671_9150)]" + evenStroke="stroke-[url(#paint_sr_sec_highlight_linear_671_9150)] motion-reduce:stroke-[url(#paint_sr_sec_highlight_linear_static_671_9150)]" + /> + 0 ? [1, 6] : []} + boxes={bigScreenServerBoxes} + /> -