From 70e0d4e0a6a8c5f7814323e8ad7938ebb14d5f40 Mon Sep 17 00:00:00 2001 From: Jeff Phillips Date: Fri, 6 Dec 2024 13:43:08 -0500 Subject: [PATCH] Use local storage to remember user's theme preference (#3554) --- frontend/src/app/ThemeContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/ThemeContext.tsx b/frontend/src/app/ThemeContext.tsx index f4fdc357c0..1649f6360c 100644 --- a/frontend/src/app/ThemeContext.tsx +++ b/frontend/src/app/ThemeContext.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { useBrowserStorage } from '~/components/browserStorage'; type ThemeContextProps = { theme: string; @@ -14,7 +15,7 @@ type ThemeProviderProps = { children: React.ReactNode; }; export const ThemeProvider: React.FC = ({ children }) => { - const [theme, setTheme] = React.useState('light'); + const [theme, setTheme] = useBrowserStorage('odh.dashboard.ui.theme', 'light'); const contextValue = React.useMemo(() => ({ theme, setTheme }), [theme, setTheme]);