Skip to content

Commit 24f6df0

Browse files
authored
Merge pull request #15774 from ethereum/perf-10yr
performance: 10 Year page priority/lazy loading adjustments
2 parents 920d6db + dfd6e55 commit 24f6df0

File tree

30 files changed

+653
-464
lines changed

30 files changed

+653
-464
lines changed

app/[locale]/10years/_components/AdoptionSwiper.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"use client"
2+
3+
import { Image } from "@/components/Image"
4+
import Translation from "@/components/Translation"
5+
import { ButtonLink } from "@/components/ui/buttons/Button"
6+
import {
7+
Swiper,
8+
SwiperContainer,
9+
SwiperNavigation,
10+
SwiperSlide,
11+
} from "@/components/ui/swiper"
12+
13+
import { cn } from "@/lib/utils/cn"
14+
15+
import { AdoptionCard } from "../types"
16+
17+
type AdoptionCardProps = {
18+
adoptionCards: AdoptionCard[]
19+
adoptionStyles: string[]
20+
}
21+
22+
const AdoptionSwiper = ({
23+
adoptionCards,
24+
adoptionStyles,
25+
}: AdoptionCardProps) => (
26+
<div className="flex flex-1 flex-col gap-6 md:hidden">
27+
<SwiperContainer className="mx-auto w-full max-w-[550px]">
28+
<Swiper spaceBetween={32}>
29+
{adoptionCards.map(({ image, linkText, href, title }, index) => {
30+
return (
31+
<SwiperSlide key={title}>
32+
<div
33+
className={cn("h-full rounded-2xl p-8", adoptionStyles[index])}
34+
>
35+
<Image
36+
src={image}
37+
alt={title}
38+
className="mx-auto mb-4 h-36 object-contain"
39+
/>
40+
<h3 className="mb-4 text-2xl font-bold">{title}</h3>
41+
<p className="mb-8">
42+
<Translation
43+
id={`page-10-year-adoption-card-${index + 1}-description`}
44+
ns="page-10-year-anniversary"
45+
/>
46+
</p>
47+
<ButtonLink href={href} hideArrow variant="outline">
48+
{linkText}
49+
</ButtonLink>
50+
</div>
51+
</SwiperSlide>
52+
)
53+
})}
54+
<SwiperNavigation />
55+
</Swiper>
56+
</SwiperContainer>
57+
</div>
58+
)
59+
60+
export default AdoptionSwiper
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dynamic from "next/dynamic"
2+
3+
import Loading from "./loading"
4+
5+
export default dynamic(() => import("."), { ssr: false, loading: Loading })
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Skeleton } from "@/components/ui/skeleton"
2+
3+
const Loading = () => (
4+
<div className="flex w-full flex-col items-center gap-6 md:hidden">
5+
<div className="flex w-full max-w-[550px] flex-col gap-6 rounded-2xl bg-card-gradient-secondary p-4 sm:p-6 xl:max-w-[700px]">
6+
<Skeleton className="mx-auto size-36 rounded-4xl" />
7+
<Skeleton className="h-8 w-1/2" />
8+
<div className="space-y-1">
9+
<Skeleton className="h-5 w-[95%]" />
10+
<Skeleton className="h-5 w-full" />
11+
<Skeleton className="h-5 w-1/2" />
12+
</div>
13+
<div className="w-2/5 rounded border px-4 py-3">
14+
<Skeleton className="h-5" />
15+
</div>
16+
</div>
17+
<Skeleton className="h-6 w-40 rounded-full" />
18+
</div>
19+
)
20+
21+
export default Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dynamic from "next/dynamic"
2+
3+
import Loading from "./loading"
4+
5+
export default dynamic(() => import("."), { ssr: false, loading: Loading })
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Skeleton } from "@/components/ui/skeleton"
2+
3+
const Loading = () => (
4+
<div className="flex items-center justify-center gap-10">
5+
{Array.from({ length: 4 }).map((_, idx) => (
6+
<div
7+
key={idx}
8+
className="flex size-20 flex-col items-center justify-center gap-1 rounded-2xl border p-2 text-center shadow-md last:max-lg:hidden"
9+
>
10+
<Skeleton className="size-full" />
11+
<Skeleton className="h-5 w-8" />
12+
</div>
13+
))}
14+
</div>
15+
)
16+
17+
export default Loading

app/[locale]/10years/_components/InnovationSwiper.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"use client"
2+
3+
import { Image } from "@/components/Image"
4+
import {
5+
Swiper,
6+
SwiperContainer,
7+
SwiperNavigation,
8+
SwiperSlide,
9+
} from "@/components/ui/swiper"
10+
11+
import type { InnovationCard } from "../types"
12+
13+
type InnovationSwiperProps = {
14+
innovationCards: InnovationCard[]
15+
}
16+
const InnovationSwiper = ({ innovationCards }: InnovationSwiperProps) => (
17+
<div className="w-[100%]">
18+
<SwiperContainer className="mx-auto w-full max-w-[550px] xl:max-w-[700px]">
19+
<Swiper
20+
className="mx-auto w-full max-w-[550px] xl:max-w-[700px]"
21+
spaceBetween={32}
22+
>
23+
{innovationCards.map(
24+
({ image, title, date, description1, description2 }, index) => (
25+
<SwiperSlide
26+
key={index}
27+
className="mx-auto flex w-full max-w-[550px] flex-col gap-4 rounded-lg bg-card-gradient-secondary p-4 sm:p-6 xl:max-w-[700px]"
28+
>
29+
<Image
30+
src={image}
31+
alt={title}
32+
className="mx-auto my-4 h-auto max-h-48 object-contain"
33+
/>
34+
<div>
35+
<h3 className="mb-4">{title}</h3>
36+
<p className="text-body-secondary mb-4">{date}</p>
37+
</div>
38+
<p className="mb-4">{description1}</p>
39+
<p className="mb-4">{description2}</p>
40+
</SwiperSlide>
41+
)
42+
)}
43+
<SwiperNavigation />
44+
</Swiper>
45+
</SwiperContainer>
46+
</div>
47+
)
48+
49+
export default InnovationSwiper
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dynamic from "next/dynamic"
2+
3+
import Loading from "./loading"
4+
5+
export default dynamic(() => import("."), { ssr: false, loading: Loading })

0 commit comments

Comments
 (0)