-
Notifications
You must be signed in to change notification settings - Fork 233
[home][docs] migrate to new geistdocs facelift #1666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ba7353f
fix: migrate to new facelift
christopherkindl e83ca81
add: max-w- for footer
christopherkindl 8e69ff0
update
christopherkindl 4512766
DCO Remediation Commit for christopherkindl <53372002+christopherkind…
christopherkindl 5af95fe
Fix: Mobile menu's "close on route change" useEffect has empty depend…
vercel[bot] f2c4af9
Merge branch 'main' into ck/navbar-update
christopherkindl 7747873
fix(docs): use ds-gray-900 token for muted-foreground color
christopherkindl 7b4b6ce
fix(docs): update world component colors to use 900-level tokens
christopherkindl c9b86b1
fix(docs): update world page colors and align hero layout with TOC grid
christopherkindl 22abc8e
polish: /worlds page
christopherkindl b01af1a
feat(docs): add filterable world cards with section grouping
christopherkindl 7a937a1
fix(docs): use radix checkbox with SSR placeholder to prevent layout …
christopherkindl 1b8c0f6
fix(docs): use badge tabs for world filters instead of checkboxes
christopherkindl c1b1d01
fix: add PATH export to husky pre-commit hook for pnpm resolution
christopherkindl 1b8bba8
revert: restore .husky/pre-commit from main
christopherkindl 4b463bb
fix(docs): improve benchmark history chart UI and API performance
christopherkindl c27f4f2
fix(docs): add missing geist tokens and utilities from homepage-visuals
christopherkindl 46be669
[DO NOT MERGE][home] Adds vercel-com workflow visuals (#1674)
christopherkindl d4c63eb
fix(docs): add mobile docs bar to cookbook pages
christopherkindl 6fd286b
fix(docs): add mobile docs bar to cookbook pages
christopherkindl f777c16
Merge branch 'ck/navbar-update' of https://github.com/vercel/workflow…
christopherkindl 2a0d9b9
fix(docs): increase hero section vertical spacing
christopherkindl 352180f
chore(docs): remove recharts React 19 type shim
christopherkindl 756721e
fix(docs): hoist useTransform calls to top level of components
christopherkindl b79b89c
fix(docs): add optional chaining for world.features access
christopherkindl 5ac13aa
fix(docs): log warning when benchmark pagination cap is hit
christopherkindl ca1e320
fix(docs): make filter badges keyboard accessible
christopherkindl f0288ac
fix(docs): clean up setTimeout on unmount in globe path components
christopherkindl 0a3c37d
feat(docs): add full-width frameworks section to homepage
christopherkindl 7d7e49d
feat(docs): update navbar logo and add framework logos from geist sym…
christopherkindl a3df2fa
docs: add comment noting timestamp semantic change in benchmark API
christopherkindl 3db3c6a
fix(docs): move frameworks section after effortless setup on homepage
christopherkindl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
241 changes: 241 additions & 0 deletions
241
docs/app/[lang]/(home)/components/vercel-com-visuals/agents-visual.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,241 @@ | ||
| 'use client'; | ||
|
|
||
| import type { JSX } from 'react'; | ||
| import { | ||
| motion, | ||
| useMotionValue, | ||
| useTransform, | ||
| animate, | ||
| useInView, | ||
| useReducedMotion, | ||
| } from 'motion/react'; | ||
| import { useEffect, useRef, useState, useCallback } from 'react'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| const ANIMATION_CONFIG = { | ||
| STAGGER_DELAY: 200, | ||
| ANIMATION_DURATION: 1500, | ||
| GRADIENT_FADE_DELAY: 300, | ||
| FADE_OUT_DELAY: 800, | ||
| FADE_OUT_DURATION: 500, | ||
| PAUSE_DURATION: 1000, | ||
| TOTAL_CYCLE_TIME: 4800, | ||
| COLOR_CHANGE_THRESHOLD: { RED: 60, GREEN: 80 }, | ||
| } as const; | ||
|
|
||
| const ANIMATION_LINES = Array.from({ length: 7 }, (_, index) => ({ | ||
| id: `line-${index}`, | ||
| delay: index * ANIMATION_CONFIG.STAGGER_DELAY, | ||
| })); | ||
|
|
||
| export function AgentsVisual(): JSX.Element { | ||
| const ref = useRef<HTMLDivElement>(null); | ||
| const isInView = useInView(ref); | ||
| const shouldReduceMotion = useReducedMotion(); | ||
| const [animationKey, setAnimationKey] = useState(0); | ||
|
|
||
| const startAnimationCycle = useCallback(() => { | ||
| if (shouldReduceMotion) return; | ||
|
|
||
| setAnimationKey((prev) => prev + 1); | ||
| }, [shouldReduceMotion]); | ||
|
|
||
| useEffect(() => { | ||
| if (!isInView || shouldReduceMotion) return; | ||
|
|
||
| let intervalId: NodeJS.Timeout; | ||
|
|
||
| const scheduleNextCycle = () => { | ||
| intervalId = setTimeout(() => { | ||
| if (isInView && !shouldReduceMotion) { | ||
| startAnimationCycle(); | ||
| scheduleNextCycle(); | ||
| } | ||
| }, ANIMATION_CONFIG.TOTAL_CYCLE_TIME); | ||
| }; | ||
|
|
||
| startAnimationCycle(); | ||
| scheduleNextCycle(); | ||
|
|
||
| return () => { | ||
| clearTimeout(intervalId); | ||
| }; | ||
| }, [isInView, shouldReduceMotion, startAnimationCycle]); | ||
|
|
||
| return ( | ||
| <div | ||
| ref={ref} | ||
| className="aspect-[444/264] w-full max-w-[444px] mx-auto relative overflow-hidden" | ||
| role="img" | ||
| aria-label="Animated workflow visualization showing progressive completion of tasks" | ||
| > | ||
| <div className="w-[calc(100%-10px)] h-full flex flex-col justify-between py-[5px]"> | ||
| {ANIMATION_LINES.map((line) => ( | ||
| <AnimatedLine | ||
| key={line.id} | ||
| delay={line.delay} | ||
| animationKey={animationKey} | ||
| shouldReduceMotion={shouldReduceMotion} | ||
| /> | ||
| ))} | ||
| </div> | ||
| <div className="w-[35%] h-full absolute top-0 left-0 bg-gradient-to-r from-background-200 to-transparent pointer-events-none" /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| interface AnimatedLineProps { | ||
| delay: number; | ||
| animationKey: number; | ||
| shouldReduceMotion: boolean | null; | ||
| } | ||
|
|
||
| function AnimatedLine({ | ||
| delay, | ||
| animationKey, | ||
| shouldReduceMotion, | ||
| }: AnimatedLineProps): JSX.Element { | ||
| const width = useMotionValue(0); | ||
| const opacity = useMotionValue(1); | ||
| const [hideGradient, setHideGradient] = useState(false); | ||
| const [gradientColor, setGradientColor] = useState<'red' | 'green'>('green'); | ||
|
|
||
| useEffect(() => { | ||
| if (shouldReduceMotion) { | ||
| width.set(100); | ||
| opacity.set(1); | ||
| setHideGradient(true); | ||
| setGradientColor('green'); | ||
| return; | ||
| } | ||
|
|
||
| setHideGradient(false); | ||
| width.set(0); | ||
| opacity.set(1); | ||
|
|
||
| const widthControls = animate(width, 100, { | ||
| duration: ANIMATION_CONFIG.ANIMATION_DURATION / 1000, | ||
| delay: delay / 1000, | ||
| ease: [0.4, 0.04, 0.04, 1], | ||
| }); | ||
|
|
||
| const timeoutIds: NodeJS.Timeout[] = []; | ||
|
|
||
| const unsubscribe = width.on('change', (latest) => { | ||
| if ( | ||
| latest > ANIMATION_CONFIG.COLOR_CHANGE_THRESHOLD.RED && | ||
| latest < ANIMATION_CONFIG.COLOR_CHANGE_THRESHOLD.GREEN | ||
| ) { | ||
| setGradientColor('red'); | ||
| } | ||
| if (latest >= ANIMATION_CONFIG.COLOR_CHANGE_THRESHOLD.GREEN) { | ||
| setGradientColor('green'); | ||
| } | ||
| }); | ||
|
|
||
| void widthControls.finished.then(() => { | ||
| const timeout1 = setTimeout( | ||
| () => setHideGradient(true), | ||
| ANIMATION_CONFIG.GRADIENT_FADE_DELAY | ||
| ); | ||
| const timeout2 = setTimeout( | ||
| () => setGradientColor('green'), | ||
| ANIMATION_CONFIG.GRADIENT_FADE_DELAY * 2 | ||
| ); | ||
|
|
||
| timeoutIds.push(timeout1, timeout2); | ||
|
|
||
| animate(opacity, 0, { | ||
| duration: ANIMATION_CONFIG.FADE_OUT_DURATION / 1000, | ||
| delay: ANIMATION_CONFIG.FADE_OUT_DELAY / 1000, | ||
| ease: [0.4, 0.04, 0.04, 1], | ||
| }); | ||
| }); | ||
|
|
||
| return () => { | ||
| widthControls.stop(); | ||
| unsubscribe(); | ||
| timeoutIds.forEach(clearTimeout); | ||
| }; | ||
| }, [animationKey, width, opacity, delay, shouldReduceMotion]); | ||
|
|
||
| return ( | ||
| <div className="w-full relative text-gray-600"> | ||
| <DashedLine /> | ||
| <motion.div | ||
| style={{ | ||
| width: useTransform(width, (v) => `${v}%`), | ||
| opacity: opacity, | ||
| }} | ||
| className="absolute top-0 left-0 overflow-hidden" | ||
| > | ||
| <div className="w-full"> | ||
| <SolidLine /> | ||
| <GradientLine color={gradientColor} hideGradient={hideGradient} /> | ||
| </div> | ||
| </motion.div> | ||
| <Arrow /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function SolidLine(): JSX.Element { | ||
| return <div className="w-full h-0.5 bg-gray-600" />; | ||
| } | ||
|
|
||
| function DashedLine(): JSX.Element { | ||
| return ( | ||
| <svg | ||
| className="w-full block" | ||
| height="2" | ||
| fill="none" | ||
| viewBox="0 0 432 2" | ||
| aria-hidden="true" | ||
| > | ||
| <path | ||
| stroke="currentColor" | ||
| strokeDasharray="4 4" | ||
| strokeWidth="2" | ||
| d="M432 1H0" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } | ||
|
|
||
| interface GradientLineProps { | ||
| hideGradient: boolean; | ||
| color?: 'green' | 'red'; | ||
| } | ||
|
|
||
| function GradientLine({ | ||
| hideGradient, | ||
| color = 'red', | ||
| }: GradientLineProps): JSX.Element { | ||
| return ( | ||
| <div | ||
| className={cn( | ||
| 'absolute top-0 right-0 w-12 h-0.5 transition-all duration-300', | ||
| hideGradient && 'opacity-0', | ||
| color === 'green' && | ||
| 'bg-gradient-to-r from-gray-600 via-green-700 to-gray-600', | ||
| color === 'red' && | ||
| 'bg-gradient-to-r from-gray-600 via-red-700 to-gray-600' | ||
| )} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| function Arrow(): JSX.Element { | ||
| return ( | ||
| <svg | ||
| className="absolute top-1/2 -right-2.5 -translate-y-1/2" | ||
| width="10" | ||
| height="12" | ||
| viewBox="0 0 10 12" | ||
| fill="none" | ||
| aria-hidden="true" | ||
| > | ||
| <path fill="currentColor" d="m0 12 10-6L0 0z" /> | ||
| </svg> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.