mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-02-12 02:00:40 +08:00
Abstract SettingsContext out
This commit is contained in:
21
src/context/SettingsContext.jsx
Normal file
21
src/context/SettingsContext.jsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { createContext, useState } from "react";
|
||||
|
||||
export const SettingsContext = createContext(null);
|
||||
|
||||
export default function SettingsContextProvider({ children }) {
|
||||
const [settings, setSettings] = useState({
|
||||
strictMode: false,
|
||||
showFieldSummary: true,
|
||||
showGrid: true,
|
||||
mode: "light",
|
||||
autosave: true,
|
||||
panning: true,
|
||||
showCardinality: true,
|
||||
});
|
||||
|
||||
return (
|
||||
<SettingsContext.Provider value={{ settings, setSettings }}>
|
||||
{children}
|
||||
</SettingsContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user