From fe7bb07ac43b031d9fcd29fc14a2ad4c1bbc1ad5 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 21 Jul 2024 20:28:44 -0500 Subject: [PATCH] Add configuration for preferred initial theme --- README.md | 1 + src/app/layout.tsx | 6 +++++- src/components/Spinner.tsx | 4 ++-- src/site/SiteChecklistClient.tsx | 32 +++++++++++++++++++++++--------- src/site/config.ts | 8 ++++++++ 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 81c4fe0a..f8848593 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ Application behavior can be changed by configuring the following environment var #### Site behavior - `NEXT_PUBLIC_GRID_HOMEPAGE = 1` shows grid layout on homepage +- `NEXT_PUBLIC_DEFAULT_THEME = light | dark` sets preferred initial theme (defaults to `system` when not configured) - `NEXT_PUBLIC_PRO_MODE = 1` enables higher quality image storage (results in increased storage usage) - `NEXT_PUBLIC_STATICALLY_OPTIMIZE_PAGES = 1` enables static optimization for pages, i.e., renders pages at build time (results in increased project usage)—⚠️ _Experimental_ - `NEXT_PUBLIC_STATICALLY_OPTIMIZE_OG_IMAGES = 1` enables static optimization for OG images, i.e., renders images at build time (results in increased project usage)—⚠️ _Experimental_ diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3cc2f42b..59aaec56 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,7 @@ import { clsx } from 'clsx/lite'; import { IBM_Plex_Mono } from 'next/font/google'; import { BASE_URL, + DEFAULT_THEME, SITE_DESCRIPTION, SITE_DOMAIN_OR_TITLE, SITE_TITLE, @@ -79,7 +80,10 @@ export default function RootLayout({ - +
} optional > - - Set environment variable to {'"1"'} to enable - higher quality image storage: - {renderEnvVars(['NEXT_PUBLIC_PRO_MODE'])} - + + {'Set environment variable to \'light\' or \'dark\''} + {' '} + to configure initial theme + {' '} + (defaults to {'\'system\''}): + {renderEnvVars(['NEXT_PUBLIC_DEFAULT_THEME'])} + + + Set environment variable to {'"1"'} to enable + higher quality image storage: + {renderEnvVars(['NEXT_PUBLIC_PRO_MODE'])} +