1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

start typescript & chakra-ui 1.0 migrations [skip ci]

This commit is contained in:
checktheroads
2020-10-18 14:47:33 -07:00
parent 79c2fe81c4
commit 49183bd3a6
26 changed files with 1213 additions and 1078 deletions

View File

@@ -0,0 +1,33 @@
import { createState, useState } from '@hookstate/core';
import type { IGlobalState } from './types';
// const StateContext = createContext(null);
// export const StateProvider = ({ children }) => {
// const [isSubmitting, setSubmitting] = useState(false);
// const [formData, setFormData] = useState({});
// const [greetingAck, setGreetingAck] = useSessionStorage('hyperglass-greeting-ack', false);
// const resetForm = layoutRef => {
// layoutRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
// setSubmitting(false);
// setFormData({});
// };
// const value = useMemo(() => ({
// isSubmitting,
// setSubmitting,
// formData,
// setFormData,
// greetingAck,
// setGreetingAck,
// resetForm,
// }));
// return <StateContext.Provider value={value}>{children}</StateContext.Provider>;
// };
// export const useHyperglassState = () => useContext(StateContext);
export const globalState = createState<IGlobalState>({
isSubmitting: false,
formData: { query_location: [], query_target: '', query_type: '', query_vrf: '' },
});
export const useGlobalState = () => useState(globalState);