Skip to content

Commit ecb17d1

Browse files
committed
feat: Implement performance optimizations
1 parent 5444ce4 commit ecb17d1

5 files changed

Lines changed: 37 additions & 28 deletions

File tree

app/globals.css

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
@apply border-border;
7474
}
7575
html {
76-
font-family: General Sans, system-ui, sans-serif;
76+
font-family: var(--font-general-sans), system-ui, sans-serif;
7777
scroll-behavior: smooth;
7878
/* Offset native anchor/scroll operations for sticky header */
7979
scroll-padding-top: 7.5rem;
@@ -127,22 +127,6 @@
127127
}
128128
}
129129

130-
@font-face {
131-
font-family: "General Sans";
132-
font-weight: 400;
133-
font-style: normal;
134-
src: url("/fonts/general-sans/GeneralSans-Regular.woff2"), format("woff2");
135-
font-display: swap;
136-
}
137-
138-
@font-face {
139-
font-family: "General Sans";
140-
font-weight: 500;
141-
font-style: normal;
142-
src: url("/fonts/general-sans/GeneralSans-Medium.woff2"), format("woff2");
143-
font-display: swap;
144-
}
145-
146130
@keyframes ticker {
147131
0% {
148132
transform: translateX(0);
@@ -156,14 +140,6 @@
156140
animation: ticker 75s linear infinite;
157141
}
158142

159-
@font-face {
160-
font-family: "General Sans";
161-
font-weight: 600;
162-
font-style: normal;
163-
src: url("/fonts/general-sans/GeneralSans-Semibold.woff2"), format("woff2");
164-
font-display: swap;
165-
}
166-
167143
/* Text selection */
168144
::selection {
169145
background: #892be280;

app/layout.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ import type { Metadata } from "next";
44
import Header from "@/components/Header";
55
import Footer from "@/components/Footer";
66
import Script from "next/script";
7+
import localFont from "next/font/local";
8+
9+
const generalSans = localFont({
10+
src: [
11+
{
12+
path: "../public/fonts/general-sans/GeneralSans-Regular.woff2",
13+
weight: "400",
14+
style: "normal",
15+
},
16+
{
17+
path: "../public/fonts/general-sans/GeneralSans-Medium.woff2",
18+
weight: "500",
19+
style: "normal",
20+
},
21+
{
22+
path: "../public/fonts/general-sans/GeneralSans-Semibold.woff2",
23+
weight: "600",
24+
style: "normal",
25+
},
26+
],
27+
variable: "--font-general-sans",
28+
display: "swap",
29+
});
730

831
export const metadata: Metadata = {
932
metadataBase: new URL("https://lap.onl/"),
@@ -74,7 +97,7 @@ export default function RootLayout({
7497
const GA_TRACKING_ID = process.env.NEXT_PUBLIC_MEASURING_ID || "";
7598

7699
return (
77-
<html lang="en" className="scroll-smooth">
100+
<html lang="en" className={`scroll-smooth ${generalSans.variable}`}>
78101
<head>
79102
<link rel="icon" href="/logos/LAP-Logo-Color.png" type="image/png" />
80103
<link

components/Header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import Link from "next/link";
4+
import Image from "next/image";
45
import menuLinks from "@/data/menu";
56
import SocialSharing from "./SocialSharing";
67
import Search, { SearchItem } from "./Search";
@@ -56,10 +57,13 @@ export default function Header() {
5657
aria-label="Return to homepage"
5758
className="block w-fit"
5859
>
59-
<img
60+
<Image
6061
className="w-[10%]"
6162
src="/logos/LAP-Logo-Transparent.png"
6263
alt="logo"
64+
width={600}
65+
height={600}
66+
priority
6367
/>
6468
</Link>
6569
</div>

components/LatestPosts/LatestPosts.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export default function LatestPosts({
103103
width={1488}
104104
height={992}
105105
priority
106+
fetchPriority="high"
106107
sizes="(max-width: 768px) 100vw, 50vw"
107108
/>
108109
</div>

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,10 @@
5050
"postcss": "^8.4.31",
5151
"tailwindcss": "^3.3.3",
5252
"typescript": "^5.2.2"
53-
}
53+
},
54+
"browserslist": [
55+
"defaults",
56+
"not IE 11",
57+
"not dead"
58+
]
5459
}

0 commit comments

Comments
 (0)