Skip to content

Commit febb51c

Browse files
committed
refactor(layout): extract background grid to separate component
1 parent 3b588ed commit febb51c

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

app/layout.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { SITE_CONFIG, SITE_METADATA } from '@/app.config';
77
import AppFooter from '@/components/business/app-footer';
88
import AppHeader from '@/components/business/app-header';
99
import FixedContactButton from '@/components/business/buttons/fixed-contact-button';
10-
import { FlickeringGrid } from "@/components/ui/flickering-grid";
10+
import BackgroundGrid from '@/components/ui/background-grid';
1111
import "./globals.css";
1212

1313
const geistSans = Geist({
@@ -81,16 +81,7 @@ export default async function RootLayout({
8181
className={`${geistSans.variable} ${geistMono.variable} antialiased flex h-full flex-col`}
8282
>
8383
<ThemeProvider enableSystem attribute="class">
84-
<div className="absolute top-0 left-0 w-screen h-screen pointer-events-none z-0">
85-
<FlickeringGrid className="absolute inset-0 z-0 size-full opacity-30"
86-
squareSize={25}
87-
gridGap={6}
88-
color="#6B7280"
89-
maxOpacity={0.3}
90-
flickerChance={0.5}
91-
/>
92-
<div className="absolute inset-0 bg-gradient-to-t from-background via-background/80 to-transparent" />
93-
</div>
84+
<BackgroundGrid />
9485
<AppHeader />
9586
{children}
9687
<AppFooter />

components/ui/background-grid.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { FlickeringGrid } from "@/components/ui/flickering-grid"
2+
3+
export default function BackgroundGrid() {
4+
return (
5+
<div className="absolute top-0 left-0 w-screen h-screen pointer-events-none z-0">
6+
<FlickeringGrid
7+
className="absolute inset-0 z-0 size-full opacity-30"
8+
squareSize={25}
9+
gridGap={6}
10+
color="#6B7280"
11+
maxOpacity={0.3}
12+
flickerChance={0.5}
13+
/>
14+
<div className="absolute inset-0 bg-gradient-to-t from-background via-background/80 to-transparent" />
15+
</div>
16+
)
17+
}
18+

0 commit comments

Comments
 (0)