From 4aacd4d3a288726f2f53fad06f88d979f183e144 Mon Sep 17 00:00:00 2001 From: Yuhao <16722967+clementinelove@users.noreply.github.com> Date: Tue, 5 Nov 2024 23:59:58 +0000 Subject: [PATCH 1/3] Add pppangram fonts as a git submodule --- .gitmodules | 3 +++ src/app/layout.tsx | 39 +++++++++++++++++++++++++++------------ src/assets/fonts | 1 + tailwind.config.js | 6 +++--- 4 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 .gitmodules create mode 160000 src/assets/fonts diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8fab069 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/assets/fonts"] + path = src/assets/fonts + url = https://github.com/now-u/now-u-fonts.git diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 5089e35..db11697 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,7 +2,7 @@ import React, { lazy } from "react"; import { Navbar } from "@/components/Navbar"; import "./globals.css"; -import { Nunito, Nunito_Sans } from "next/font/google"; +import localFont from "next/font/local"; import { Footer } from "@/components/Footer"; import { getRequiredEnvironmentVariable } from "@/utils/getRequiredEnvironmentVariable"; import { Toaster } from "@/components/ui/toaster"; @@ -14,16 +14,31 @@ const GA_TAG = getRequiredEnvironmentVariable("GA_TAG_ID"); const GTAG_TAG = getRequiredEnvironmentVariable("GTAG_TAG_ID"); const AW_TAG = getRequiredEnvironmentVariable("AW_TAG_ID"); -const nunito = Nunito({ - subsets: ["latin"], - variable: "--font-nunito", -}); - -const nunitoSans = Nunito_Sans({ - subsets: ["latin"], - variable: "--font-nunito-sans", - weight: ["400"], -}); +const ppPangram = localFont({ + src: [ + { + path: '../assets/fonts/PPPangramSansRounded-Regular/PPPangramSansRounded-Regular.woff2', + weight: '400', + style: 'normal' + }, + { + path: '../assets/fonts/PPPangramSansRounded-Medium/PPPangramSansRounded-Medium.woff2', + weight: '500', + style: 'normal' + }, + { + path: '../assets/fonts/PPPangramSansRounded-Semibold/PPPangramSansRounded-Semibold.woff2', + weight: '600', + style: 'normal' + }, + { + path: '../assets/fonts/PPPangramSansRounded-Bold/PPPangramSansRounded-Bold.woff2', + weight: '700', + style: 'normal' + } + ], + variable: '--font-pppangram' +}) interface RootLayoutProps { children: React.ReactNode; @@ -31,7 +46,7 @@ interface RootLayoutProps { export default function RootLayout({ children }: RootLayoutProps): JSX.Element { return ( - + diff --git a/src/assets/fonts b/src/assets/fonts new file mode 160000 index 0000000..9e183a2 --- /dev/null +++ b/src/assets/fonts @@ -0,0 +1 @@ +Subproject commit 9e183a299b354fd22c78ccf272d06088212c8c15 diff --git a/tailwind.config.js b/tailwind.config.js index 600c6ba..9b1fab5 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -96,9 +96,9 @@ module.exports = { "accordion-up": "accordion-up 0.2s ease-out", }, fontFamily: { - sans: ["var(--font-nunito-sans)"], - heading: ["var(--font-nunito)"], - subheading: ["var(--font-nunito-sans)"], + sans: ["var(--font-pppangram)"], + heading: ["var(--font-pppangram)"], + subheading: ["var(--font-pppangram)"], }, }, }, From 28332229f228760a13e61ae521975f2248db0274 Mon Sep 17 00:00:00 2001 From: Yuhao <16722967+clementinelove@users.noreply.github.com> Date: Wed, 6 Nov 2024 00:50:36 +0000 Subject: [PATCH 2/3] restore fonts submodule in build step --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3d6c26a..b9a7cb9 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "private": true, "scripts": { "dev": "pnpm run generate && next dev", - "build": "pnpm run generate && next build", + "build": "pnpm run restore-fonts-submodule && pnpm run generate && next build", "start": "next start", "format": "prettier --write .", "lint": "next lint", "lint:fix": "next lint --fix", "generate": "pnpm run generate-api-client", - "generate-api-client": "npx openapi-typescript https://causes.dev.apiv2.now-u.com/api/schema/ --output src/services/apiTypes.ts" + "generate-api-client": "npx openapi-typescript https://causes.dev.apiv2.now-u.com/api/schema/ --output src/services/apiTypes.ts", + "restore-fonts-submodule": "test -d src/assets/fonts && echo \"fonts submodule exist\" || git submodule add --force https://github.com/now-u/now-u-fonts.git ./src/assets/fonts" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.6.0", From 1db5692d0cc8c2a9367214bf65f00780e8020f6f Mon Sep 17 00:00:00 2001 From: Yuhao <16722967+clementinelove@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:22:30 +0000 Subject: [PATCH 3/3] Revert "restore fonts submodule in build step" This reverts commit 28332229f228760a13e61ae521975f2248db0274. --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b9a7cb9..3d6c26a 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,13 @@ "private": true, "scripts": { "dev": "pnpm run generate && next dev", - "build": "pnpm run restore-fonts-submodule && pnpm run generate && next build", + "build": "pnpm run generate && next build", "start": "next start", "format": "prettier --write .", "lint": "next lint", "lint:fix": "next lint --fix", "generate": "pnpm run generate-api-client", - "generate-api-client": "npx openapi-typescript https://causes.dev.apiv2.now-u.com/api/schema/ --output src/services/apiTypes.ts", - "restore-fonts-submodule": "test -d src/assets/fonts && echo \"fonts submodule exist\" || git submodule add --force https://github.com/now-u/now-u-fonts.git ./src/assets/fonts" + "generate-api-client": "npx openapi-typescript https://causes.dev.apiv2.now-u.com/api/schema/ --output src/services/apiTypes.ts" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.6.0",