init import projet
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext, useState } from "react";
|
||||
import type { PredictionTheme } from "@/features/predictions/domain/prediction-theme";
|
||||
|
||||
type PredictionThemeContextValue = {
|
||||
theme: PredictionTheme;
|
||||
setTheme: (theme: PredictionTheme) => void;
|
||||
};
|
||||
|
||||
const PredictionThemeContext = createContext<PredictionThemeContextValue>({
|
||||
theme: "boy",
|
||||
setTheme: () => {},
|
||||
});
|
||||
|
||||
export function PredictionThemeProvider({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const [theme, setTheme] = useState<PredictionTheme>("boy");
|
||||
return (
|
||||
<PredictionThemeContext.Provider value={{ theme, setTheme }}>
|
||||
{children}
|
||||
</PredictionThemeContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function usePredictionTheme() {
|
||||
return useContext(PredictionThemeContext);
|
||||
}
|
||||
Reference in New Issue
Block a user