mirror of
https://github.com/exogen/t2-model-skinner.git
synced 2026-03-12 00:40:37 +00:00
26 lines
748 B
TypeScript
26 lines
748 B
TypeScript
import React, { useContext } from "react";
|
|
|
|
interface EnvironmentContextValue {
|
|
selectedEnvironment: string | null;
|
|
setSelectedEnvironment: (selectedEnvironment: string | null) => void;
|
|
showEnvironment: boolean;
|
|
setShowEnvironment: (showEnvironment: boolean) => void;
|
|
exposure: number;
|
|
setExposure: (exposure: number) => void;
|
|
environmentImageUrl: string | null;
|
|
}
|
|
|
|
const EnvironmentContext = React.createContext<EnvironmentContextValue | null>(
|
|
null
|
|
);
|
|
EnvironmentContext.displayName = "EnvironmentContext";
|
|
|
|
export { EnvironmentContext };
|
|
|
|
export default function useEnvironment() {
|
|
const context = useContext(EnvironmentContext);
|
|
if (!context) {
|
|
throw new Error("No EnvironmentContext.Provider");
|
|
}
|
|
return context;
|
|
}
|