From 8859802da39ace22241b659d8fa9450794985d71 Mon Sep 17 00:00:00 2001 From: Xavier Desoindre Date: Thu, 5 Dec 2024 10:10:07 +0100 Subject: [PATCH] fix: fonts from cdn --- app/api/dynamics/comparateur/route.tsx | 12 +++++++++--- app/api/dynamics/equivalents/[slug]/route.tsx | 12 +++++++++--- app/layout.tsx | 6 +++--- src/utils/fonts.css | 12 ++++++------ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/api/dynamics/comparateur/route.tsx b/app/api/dynamics/comparateur/route.tsx index 4aa7af208..75bd2240f 100644 --- a/app/api/dynamics/comparateur/route.tsx +++ b/app/api/dynamics/comparateur/route.tsx @@ -20,9 +20,15 @@ export async function GET(req: NextRequest) { if (fonts.length === 0) { fonts = ( await Promise.all([ - getFont(new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Regular.woff', import.meta.url)), - getFont(new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Medium.woff', import.meta.url)), - getFont(new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Bold.woff', import.meta.url)), + getFont( + new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Regular.woff', import.meta.url) + ), + getFont( + new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Medium.woff', import.meta.url) + ), + getFont( + new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Bold.woff', import.meta.url) + ), ]) ).map((font, index) => ({ name: 'Marianne', diff --git a/app/api/dynamics/equivalents/[slug]/route.tsx b/app/api/dynamics/equivalents/[slug]/route.tsx index f7c3dfbfa..8f423d276 100644 --- a/app/api/dynamics/equivalents/[slug]/route.tsx +++ b/app/api/dynamics/equivalents/[slug]/route.tsx @@ -35,9 +35,15 @@ export async function GET(req: NextRequest, context: { params: Promise<{ slug: s if (fonts.length === 0) { fonts = ( await Promise.all([ - getFont(new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Regular.woff', import.meta.url)), - getFont(new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Medium.woff', import.meta.url)), - getFont(new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Bold.woff', import.meta.url)), + getFont( + new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Regular.woff', import.meta.url) + ), + getFont( + new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Medium.woff', import.meta.url) + ), + getFont( + new URL('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Bold.woff', import.meta.url) + ), ]) ).map((font, index) => ({ name: 'Marianne', diff --git a/app/layout.tsx b/app/layout.tsx index b9832c98a..639692992 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -19,9 +19,9 @@ export const metadata: Metadata = { } const fonts = [ - 'https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Regular.woff2', - 'https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Medium.woff2', - 'https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Bold.woff2', + 'https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Regular.woff2', + 'https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Medium.woff2', + 'https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Bold.woff2', ] const RootLayout = ({ children }: { children: React.ReactNode }) => { diff --git a/src/utils/fonts.css b/src/utils/fonts.css index 28468cc8e..e3120d243 100644 --- a/src/utils/fonts.css +++ b/src/utils/fonts.css @@ -1,8 +1,8 @@ @font-face { font-family: 'Marianne'; src: - url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Regular.woff2') format('woff2'), - url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Regular.woff') format('woff'); + url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Regular.woff2') format('woff2'), + url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Regular.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; @@ -11,8 +11,8 @@ @font-face { font-family: 'Marianne'; src: - url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Medium.woff2') format('woff2'), - url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Medium.woff') format('woff'); + url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Medium.woff2') format('woff2'), + url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Medium.woff') format('woff'); font-weight: 500; font-style: normal; font-display: swap; @@ -21,8 +21,8 @@ @font-face { font-family: 'Marianne'; src: - url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Bold.woff2') format('woff2'), - url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr/dist/fonts/Marianne-Bold.woff') format('woff'); + url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Bold.woff2') format('woff2'), + url('https://cdn.jsdelivr.net/npm/@gouvfr/dsfr@12.1.1/dist/fonts/Marianne-Bold.woff') format('woff'); font-weight: 700; font-style: normal; font-display: swap;