32 lines
778 B
TypeScript
32 lines
778 B
TypeScript
"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);
|
|
}
|