11"use client" ;
22import Link from "next/link" ;
3+ import { useTheme } from "next-themes" ;
34import { Button } from "@/components/ui/button" ;
45import { Copy , SquareArrowOutUpRight } from "lucide-react" ;
56import {
@@ -8,21 +9,32 @@ import {
89 TabsList ,
910 TabsTrigger ,
1011} from "fumadocs-ui/components/tabs" ;
12+ import { useServerTheme } from "@/components/theme-provider" ;
1113import { Anthropic , Google , OpenAI } from "@lobehub/icons" ;
1214import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock" ;
1315
1416export function Hero ( ) {
17+ const { resolvedTheme } = useTheme ( ) ;
18+ const { serverTheme } = useServerTheme ( ) ;
19+ const theme = resolvedTheme || serverTheme ;
20+ const isDark = theme === "dark" ;
21+
22+ const gridColor = isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)" ;
23+ const overlayBackground = isDark
24+ ? "radial-gradient(ellipse 120% 100% at 50% 0%, transparent 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.7) 100%)"
25+ : "radial-gradient(ellipse 120% 100% at 50% 0%, transparent 0%, rgba(255,255,255,0.3) 60%, rgba(255,255,255,0.7) 100%)" ;
26+
1527 return (
16- < div className = "h-full w-full mt-[-12px] relative flex flex-col items-center justify-center bg-black text-white md:p-8" >
28+ < div className = "relative flex flex-col items-center justify-center min-h-[calc(100vh-64px)] w-full overflow-hidden p-4 md:p-8" >
1729 { /* Background Grid with Gradient Overlay */ }
1830 < div className = "absolute inset-0 pointer-events-none" >
1931 { /* Grid Pattern */ }
2032 < div
2133 className = "absolute inset-0"
2234 style = { {
2335 backgroundImage : `
24- linear-gradient(to right, rgba(255,255,255,0.08) 1px, transparent 1px),
25- linear-gradient(to bottom, rgba(255,255,255,0.08) 1px, transparent 1px)
36+ linear-gradient(to right, ${ gridColor } 1px, transparent 1px),
37+ linear-gradient(to bottom, ${ gridColor } 1px, transparent 1px)
2638 ` ,
2739 backgroundSize : "80px 80px" ,
2840 } }
@@ -32,54 +44,53 @@ export function Hero() {
3244 < div
3345 className = "absolute inset-0"
3446 style = { {
35- background :
36- "radial-gradient(ellipse 120% 100% at 50% 0%, transparent 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.7) 100%)" ,
47+ background : overlayBackground ,
3748 } }
3849 />
3950 </ div >
4051
4152 < div className = "relative z-10 grid grid-cols-1 lg:grid-cols-2 gap-12 max-w-7xl w-full items-center" >
4253 { /* Left Column */ }
4354 < div className = "flex flex-col items-start text-left space-y-6" >
44- < div className = "flex items-center gap-2 mb-2 text-xs text-gray-400" >
45- < div className = "w-2 h-2 rounded-full bg-white/50" />
55+ < div className = "flex items-center gap-2 mb-2 text-xs text-gray-600 dark:text-gray- 400" >
56+ < div className = "w-2 h-2 rounded-full bg-black/50 dark:bg- white/50" />
4657 < span > Blazingly Fast :)</ span >
4758 </ div >
4859
49- < h1 className = "text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight text-white leading-tight" >
60+ < h1 className = "text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight text-black dark:text- white leading-tight" >
5061 The AI Toolkit for < span className = "text-orange-500" > Rust</ span >
5162 </ h1 >
5263
53- < p className = "text-base text-gray-400 max-w-xl" >
64+ < p className = "text-base text-gray-600 dark:text-gray- 400 max-w-xl" >
5465 An open-source Rust library for building AI-powered applications,
5566 inspired by the Vercel AI SDK.
5667 </ p >
5768
5869 { /* Command Snippet */ }
59- < div className = "w-full rounded-xs max-w-md bg-black border border-white/10 p-2.5 flex items-center gap-2.5 font-mono text-xs" >
60- < span className = "text-white font-semibold" >
61- < span className = "text-red-400" > cargo </ span > add{ " " }
70+ < div className = "w-full rounded-xs max-w-md bg-white border border-black/10 dark:bg-black dark: border-white/10 p-2.5 flex items-center gap-2.5 font-mono text-xs" >
71+ < span className = "text-black dark:text- white font-semibold" >
72+ < span className = "text-red-500 dark:text-red- 400" > cargo </ span > add{ " " }
6273 < span className = "text-orange-500" > aisdk</ span >
6374 </ span >
6475 < div className = "flex-1" />
6576 < Copy
66- className = "w-3.5 h-3.5 text-gray-500 cursor-pointer hover:text-white transition-colors"
77+ className = "w-3.5 h-3.5 text-gray-500 cursor-pointer hover:text-black dark:hover:text- white transition-colors"
6778 onClick = { ( ) => navigator . clipboard . writeText ( "cargo add aisdk" ) }
6879 />
6980 </ div >
7081 < div className = "flex flex-wrap gap-3" >
7182 < Button
7283 asChild
7384 size = "default"
74- className = "bg-white rounded-xs font-semibold text-black hover:bg-gray-200 px-6"
85+ className = "bg-black dark:bg- white rounded-xs font-semibold text-white dark:text- black hover:bg-gray-800 dark: hover:bg-gray-200 px-6"
7586 >
7687 < Link href = "/docs" > GET STARTED</ Link >
7788 </ Button >
7889 < Button
7990 variant = "outline"
8091 size = "default"
8192 asChild
82- className = "px-5 rounded-xs border-white/10 bg-transparent text-white hover:bg-white/5 hover:text-white"
93+ className = "px-5 rounded-xs border-black/10 dark:border- white/10 bg-transparent text-black dark:text- white hover:bg-black/5 dark:hover:bg- white/5 hover:text-black dark: hover:text-white"
8394 >
8495 < Link href = "https://github.com/lazy-hq/aisdk" target = "_blank" >
8596 < SquareArrowOutUpRight className = "mr-1 h-4 w-4" />
0 commit comments