mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-03 04:18:16 +03:00
21 lines
639 B
TypeScript
21 lines
639 B
TypeScript
import React, { createContext, useState } from "react";
|
|
import { JustChildren, SetState } from "types/react";
|
|
import { NO_OP } from "util/misc";
|
|
|
|
export const BackgroundContext = createContext<{
|
|
background: string | null;
|
|
setBackground: SetState<string | null>;
|
|
}>({ background: null, setBackground: NO_OP });
|
|
|
|
BackgroundContext.displayName = "BackgroundContext";
|
|
|
|
export function BackgroundContextProvider({ children }: JustChildren) {
|
|
const [background, setBackground] = useState<string | null>(null);
|
|
|
|
return (
|
|
<BackgroundContext.Provider value={{ background, setBackground }}>
|
|
{children}
|
|
</BackgroundContext.Provider>
|
|
);
|
|
}
|