-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fed1d2e
commit 434d081
Showing
4 changed files
with
36 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { create } from "zustand"; | ||
import { persist } from "zustand/middleware"; | ||
|
||
export type MobileEditorTab = "text" | "graph"; | ||
|
||
export type MobileStore = { | ||
tab: MobileEditorTab; | ||
toggleTab: () => void; | ||
}; | ||
|
||
/** | ||
* Stores client-side state related to the editor. | ||
*/ | ||
export const useMobileStore = create<MobileStore>()( | ||
persist( | ||
(set) => ({ | ||
tab: "text", | ||
toggleTab: () => | ||
set((state) => ({ | ||
tab: state.tab === "text" ? "graph" : "text", | ||
})), | ||
}), | ||
{ | ||
name: "ff-mobile-store", | ||
} | ||
) | ||
); |