Skip to content
Snippets Groups Projects
Commit c06378a3 authored by Dima Rifai's avatar Dima Rifai
Browse files

Ticket #366 - Add useEffect and call setCssVariablesFromEnv to apply the CSS variables

parent af4aa4a5
No related branches found
No related tags found
2 merge requests!481bring recent develop changes to mater to match the backend,!454Delrifai/#allow env level configuration of default site colors
Pipeline #108421 failed
import React, { createContext, useContext, useEffect, useState } from "react";
import { setCssVariablesFromEnv } from "@/utils/EnvCssVariables";
type ThemeContextType = {
theme: string;
......@@ -27,6 +28,11 @@ export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({
}
}, []);
useEffect(() => {
// Apply the CSS variables when the component is mounted
setCssVariablesFromEnv();
}, [theme]);
const toggleTheme = () => {
const newTheme = theme === "dark" ? "light" : "dark";
setTheme(newTheme);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment