This repository was archived by the owner on Mar 24, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathretro-grid.tsx
More file actions
39 lines (34 loc) · 1.27 KB
/
retro-grid.tsx
File metadata and controls
39 lines (34 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { cn } from '@/lib/utils';
export default function RetroGrid({
className,
angle = 65,
}: {
className?: string;
angle?: number;
}) {
return (
<div
className={cn(
'pointer-events-none absolute size-full overflow-hidden opacity-50 [perspective:200px]',
className
)}
style={{ '--grid-angle': `${angle}deg` } as React.CSSProperties}
>
{/* Grid */}
<div className="absolute inset-0 [transform:rotateX(var(--grid-angle))]">
<div
className={cn(
'animate-grid',
'[background-repeat:repeat] [background-size:60px_60px] [height:300vh] [inset:0%_0px] [margin-left:-50%] [transform-origin:100%_0_0] [width:600vw]',
// Light Styles
'[background-image:linear-gradient(to_right,rgba(0,0,0,0.3)_1px,transparent_0),linear-gradient(to_bottom,rgba(0,0,0,0.3)_1px,transparent_0)]',
// Dark styles
'dark:[background-image:linear-gradient(to_right,rgba(255,255,255,0.2)_1px,transparent_0),linear-gradient(to_bottom,rgba(255,255,255,0.2)_1px,transparent_0)]'
)}
/>
</div>
{/* Background Gradient */}
<div className="absolute inset-0 bg-linear-to-t from-white to-transparent to-90% dark:from-black" />
</div>
);
}