From e716c1ebc852d1001897a20089cec5efe1c78c8d Mon Sep 17 00:00:00 2001 From: KJ Monahan Date: Tue, 5 Mar 2024 13:19:06 -0500 Subject: [PATCH 1/4] Switch to new font variable method --- app/layout.tsx | 5 ++--- source/01-global/fonts/source-sans.ts | 11 +++++++++++ source/01-global/fonts/source-sans.tsx | 27 -------------------------- 3 files changed, 13 insertions(+), 30 deletions(-) create mode 100644 source/01-global/fonts/source-sans.ts delete mode 100644 source/01-global/fonts/source-sans.tsx diff --git a/app/layout.tsx b/app/layout.tsx index ec87fe2a..41017139 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,6 +1,6 @@ import { JSX, PropsWithChildren } from 'react'; import '../source/00-config/index.css'; -import SourceSansFontStyle from '../source/01-global/fonts/source-sans'; +import sourceSansPro from '../source/01-global/fonts/source-sans'; import '../source/01-global/index.css'; import Footer from '../source/02-layouts/Footer/Footer'; import Header from '../source/02-layouts/Header/Header'; @@ -15,9 +15,8 @@ import '../source/06-utility/index.css'; function RootLayout({ children }: PropsWithChildren): JSX.Element { return ( - + -
diff --git a/source/01-global/fonts/source-sans.ts b/source/01-global/fonts/source-sans.ts new file mode 100644 index 00000000..43fc85cd --- /dev/null +++ b/source/01-global/fonts/source-sans.ts @@ -0,0 +1,11 @@ +import { Source_Sans_3 as SourceSansPro } from 'next/font/google'; + +const sourceSansPro = SourceSansPro({ + display: 'auto', + subsets: ['latin'], + weight: 'variable', + fallback: ['Arial', 'sans-serif'], + variable: '--font-family-primary', +}); + +export default sourceSansPro; diff --git a/source/01-global/fonts/source-sans.tsx b/source/01-global/fonts/source-sans.tsx deleted file mode 100644 index 7266811f..00000000 --- a/source/01-global/fonts/source-sans.tsx +++ /dev/null @@ -1,27 +0,0 @@ -'use client'; - -import { Source_Sans_3 as SourceSansPro } from 'next/font/google'; - -const sourceSansPro = SourceSansPro({ - display: 'swap', - subsets: ['latin'], - weight: 'variable', -}); - -function SourceSansFontStyle() { - return ( - - ); -} - -export default SourceSansFontStyle; From ffd4608ad2e0089cd587a8962c5cb5985dba2b9c Mon Sep 17 00:00:00 2001 From: KJ Monahan Date: Tue, 5 Mar 2024 14:08:52 -0500 Subject: [PATCH 2/4] Update fonts in Storybook --- .storybook/preview.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.storybook/preview.js b/.storybook/preview.js index dd3524ef..b0c7e401 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,7 +1,7 @@ import '../source/00-config/index.css'; +import sourceSansPro from '../source/01-global/fonts/source-sans'; import '../source/01-global/index.css'; import '../source/06-utility/index.css'; -import SourceSansFontStyle from '../source/01-global/fonts/source-sans'; const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, @@ -67,14 +67,19 @@ const withWritingDirection = (Story, context) => { ); }; -const withFont = Story => ( - <> - - - -); +const withFonts = Story => { + console.log(sourceSansPro); + return ( +
+ +
+ ); +}; -const decorators = [withWritingDirection, withFont]; +const decorators = [withWritingDirection, withFonts]; const preview = { parameters, From 7bc000ed6a0cbc70f94e4bc48963abd5d079bdb3 Mon Sep 17 00:00:00 2001 From: KJ Monahan Date: Tue, 5 Mar 2024 14:21:46 -0500 Subject: [PATCH 3/4] Remove console.log --- .storybook/preview.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.storybook/preview.js b/.storybook/preview.js index b0c7e401..79fac20e 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -67,17 +67,14 @@ const withWritingDirection = (Story, context) => { ); }; -const withFonts = Story => { - console.log(sourceSansPro); - return ( -
- -
- ); -}; +const withFonts = Story => ( +
+ +
+); const decorators = [withWritingDirection, withFonts]; From 0b870cf9432353acbf9abbe3990a79453346eaca Mon Sep 17 00:00:00 2001 From: KJ Monahan Date: Tue, 5 Mar 2024 16:17:57 -0500 Subject: [PATCH 4/4] 1.1.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index aa1d9d34..9e8a5f3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nextjs-project", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nextjs-project", - "version": "1.1.0", + "version": "1.1.1", "dependencies": { "next": "^14.1.1", "react": "^18.2.0", diff --git a/package.json b/package.json index 2306abb8..6efe025b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nextjs-project", - "version": "1.1.0", + "version": "1.1.1", "private": true, "scripts": { "dev": "next dev",