From 60c49f18389ff625177a57277ef8f292a31097bf Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Sat, 28 Oct 2023 17:12:58 +0200
Subject: refactor(providers,hooks): rewrite PrismThemeProvider & usePrismTheme

* reuse Theme provider logic
* move DOM mutation from provider to hook
* add a script to init theme before page load
---
 src/pages/_app.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/pages/_app.tsx')

diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 0c92c93..caf4a96 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -3,7 +3,7 @@ import { IntlProvider } from 'react-intl';
 import '../styles/globals.scss';
 import type { AppPropsWithLayout } from '../types';
 import { settings } from '../utils/config';
-import { STORAGE_KEY } from '../utils/constants';
+import { PRISM_THEME_ATTRIBUTE, STORAGE_KEY } from '../utils/constants';
 import {
   AckeeProvider,
   MotionProvider,
@@ -37,7 +37,10 @@ const App = ({ Component, pageProps }: AppPropsWithLayout) => {
             attribute={STORAGE_KEY.THEME}
             storageKey={STORAGE_KEY.THEME}
           >
-            <PrismThemeProvider>
+            <PrismThemeProvider
+              attribute={PRISM_THEME_ATTRIBUTE}
+              storageKey={STORAGE_KEY.PRISM}
+            >
               {getLayout(<Component {...componentProps} />, {})}
             </PrismThemeProvider>
           </ThemeProvider>
-- 
cgit v1.2.3

