Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧪 Test (push) Successful in 1m16s
Monorepo Pipeline / 🧹 Lint (push) Failing after 1m27s
Monorepo Pipeline / 🏗️ Build (push) Failing after 1m29s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
18 lines
502 B
TypeScript
18 lines
502 B
TypeScript
import React, { createContext, useContext } from 'react';
|
|
|
|
export type Environment = 'web' | 'print' | 'presentation';
|
|
|
|
const EnvironmentContext = createContext<Environment>('web');
|
|
|
|
export const EnvironmentProvider: React.FC<{ env: Environment; children: React.ReactNode }> = ({ env, children }) => {
|
|
return (
|
|
<EnvironmentContext.Provider value={env}>
|
|
{children}
|
|
</EnvironmentContext.Provider>
|
|
);
|
|
};
|
|
|
|
export const useEnvironment = () => {
|
|
return useContext(EnvironmentContext);
|
|
};
|