mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 05:37:20 +01:00
Moved collapse button.
This commit is contained in:
parent
5d2c1e27c2
commit
adca3c36d0
7 changed files with 1883 additions and 37 deletions
13
src/components/hooks/useGlobalState.ts
Normal file
13
src/components/hooks/useGlobalState.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { create } from 'zustand';
|
||||
|
||||
const store = create(() => ({}));
|
||||
|
||||
const useGlobalState = (key: string, value?: any) => {
|
||||
if (value !== undefined && !store.getState()[key]) {
|
||||
store.setState({ [key]: value });
|
||||
}
|
||||
|
||||
return [store(state => state[key]), (value: any) => store.setState({ [key]: value })];
|
||||
};
|
||||
|
||||
export default useGlobalState;
|
||||
Loading…
Add table
Add a link
Reference in a new issue