Skip to content

Commit 76980d8

Browse files
committed
chore: perf improvements
1 parent 73609bd commit 76980d8

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

app/_components/footer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ export function Footer() {
8383
</div>
8484

8585
{/* Background decoration */}
86-
<div className="absolute bottom-0 left-1/2 transform -translate-x-1/2 w-[400px] h-[200px] bg-gradient-to-t from-primary/5 to-transparent rounded-full blur-3xl -z-10" />
86+
<div
87+
className="absolute bottom-0 left-1/2 w-[400px] h-[200px] bg-gradient-to-t from-primary/5 to-transparent rounded-full blur-3xl -z-10"
88+
style={{ transform: "translate3d(-50%, 0, 0)" }}
89+
/>
8790
</footer>
8891
);
8992
}

app/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DEMO_GIF_URL = "https://vhs.charm.sh/vhs-12NaAvXqgDiV647TA2C356.gif";

app/layout.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { SpeedInsights } from "@vercel/speed-insights/next";
44
import { Footer } from "./_components/footer";
55
import { Header } from "./_components/header";
66
import { Providers } from "./providers";
7+
import { DEMO_GIF_URL } from "./constants";
78

89
import "./globals.css";
910

@@ -14,6 +15,14 @@ export default function Layout({
1415
}): React.ReactElement {
1516
return (
1617
<html lang="en" className="dark">
18+
<head>
19+
<link
20+
rel="preload"
21+
href={DEMO_GIF_URL}
22+
as="image"
23+
fetchPriority="high"
24+
/>
25+
</head>
1726
<body
1827
className={"min-h-screen bg-background font-sans antialiased"}
1928
>

app/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Button, Link } from "@heroui/react";
1313
import type { Metadata } from "next";
1414
import Image from "next/image";
1515
import { FeatureCard } from "./_components/feature-card";
16+
import { DEMO_GIF_URL } from "./constants";
1617

1718
export const revalidate = 86400; // 1 day
1819

@@ -87,12 +88,15 @@ export default function Home() {
8788
<div className="relative">
8889
<div className="relative bg-gradient-to-br from-default-100 to-default-200 rounded-2xl p-3 md:p-6 shadow-2xl">
8990
<Image
90-
src="https://vhs.charm.sh/vhs-12NaAvXqgDiV647TA2C356.gif"
91+
src={DEMO_GIF_URL}
9192
width={800}
9293
height={450}
9394
alt="Demo of Cabin package manager"
9495
priority
9596
unoptimized
97+
fetchPriority="high"
98+
placeholder="blur"
99+
blurDataURL="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k="
96100
className="rounded-xl shadow-lg w-full h-auto"
97101
/>
98102
</div>
@@ -108,7 +112,10 @@ export default function Home() {
108112
</div>
109113

110114
{/* Background decoration */}
111-
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-gradient-to-r from-primary/10 to-secondary/10 rounded-full blur-3xl -z-10" />
115+
<div
116+
className="absolute top-1/2 left-1/2 w-[800px] h-[800px] bg-gradient-to-r from-primary/10 to-secondary/10 rounded-full blur-3xl -z-10"
117+
style={{ transform: "translate3d(-50%, -50%, 0)" }}
118+
/>
112119
</section>
113120

114121
{/* Features Section */}

0 commit comments

Comments
 (0)