From e7b0c7e54027656fd9ae19e2b4db175eed4d44de Mon Sep 17 00:00:00 2001 From: Charles Harwood Date: Sun, 4 Feb 2024 11:01:29 +1000 Subject: [PATCH] chore: random nitpicks --- .vscode/settings.json | 8 ++++---- README.md | 2 +- src/hooks/useThemeInitialisation.ts | 4 +++- src/utils/type-helpers.ts | 4 +--- tailwind.config.ts | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ddc5c21..8434d2c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,9 @@ "[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "[svg]": { + "editor.defaultFormatter": "jock.svg" + }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, @@ -30,8 +33,5 @@ // Extension Settings "eslint.enable": true, "eslint.format.enable": false, // formatting is handled by prettier - "prettier.enable": true, - "[svg]": { - "editor.defaultFormatter": "jock.svg" - } + "prettier.enable": true } \ No newline at end of file diff --git a/README.md b/README.md index f1fd307..3b08961 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Last but definitely not least, we have Zustand for client-side state management. Since I've done all the manual configuration stuff a million times before, this time around I decided I don't need to prove anything to anyone, so why not just use a starter template to take care of all that initial stuff that nobody wants to do? Especially now that I'm a father of two boys, I have a lot less free time and thus I need less reasons to procrastinate on actually building the damn site. -Thankfully since the last time I used Prismic to build a new site from scratch, they've introduced some great templates to get you started with various framework integrations. I used the [Prismic Next.js Multi-Page Website Starter][starter-docs] as a base, and then added all my own customisations on top of that. It's a great starter, and I highly recommend it for anyone wanting to build a Next.js site with Prismic. +Thankfully since the last time I used Prismic to build a new site from scratch, they've introduced some great templates to get you started with various framework integrations. I used the [Prismic Next.js Multi-Page Website Starter][starter-docs] as a base, converted the whole thing to TypeScript, and then added all my own customisations on top of that. It's a great starter, and I highly recommend it for anyone wanting to build a Next.js site with Prismic. - **Learn more about using Prismic with Next.js**: [Prismic Next.js Documentation][prismic-docs] diff --git a/src/hooks/useThemeInitialisation.ts b/src/hooks/useThemeInitialisation.ts index 0f9151d..2d2ae91 100644 --- a/src/hooks/useThemeInitialisation.ts +++ b/src/hooks/useThemeInitialisation.ts @@ -17,7 +17,9 @@ function setTheme(newTheme: 'dark' | 'light') { * In terms of the rules of React, this is pretty naughty lol, but it works. * The main reason for this is so that it doesn't cause dramas with server-side rendering. * If I implement stateful/reactive values into the main layout where the `html` element is rendered, - * then the entire app would be rendered client-side and SSR would be disabled. + * then the entire app would be rendered client-side and SSR/static-generation would be disabled. + * + * Note: it's also basically the same as what the official `React.dev` website does, so I'm not too worried 😅 */ export function useThemeInitialisation() { // onload effect. diff --git a/src/utils/type-helpers.ts b/src/utils/type-helpers.ts index e8fee81..ec3ffc1 100644 --- a/src/utils/type-helpers.ts +++ b/src/utils/type-helpers.ts @@ -14,8 +14,6 @@ export type PolymorphicComponentProp< declare global { interface Window { __theme: 'dark' | 'light'; - __setPreferredTheme: (theme: 'dark' | 'light') => void; + __setPreferredTheme?: (theme: 'dark' | 'light') => void; } } - -window.__setPreferredTheme = window.__setPreferredTheme || (() => {}); diff --git a/tailwind.config.ts b/tailwind.config.ts index c5a5267..1e1ea9c 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -8,8 +8,9 @@ export default { content: [ './src/app/**/*.{js,ts,jsx,tsx,mdx}', './src/components/**/*.{js,ts,jsx,tsx,mdx}', + './src/hooks/**/*.{js,ts,jsx,tsx,mdx}', './src/slices/**/*.{js,ts,jsx,tsx,mdx}', - './src/pages/**/*.{js,ts,jsx,tsx,mdx}', + './src/store/**/*.{js,ts,jsx,tsx,mdx}', './src/theme/**/*.{js,ts,jsx,tsx,mdx}', './src/utils/**/*.{js,ts,jsx,tsx,mdx}', ],