-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(code-editor): use monaco editor
- Loading branch information
1 parent
839e2f2
commit ee973d9
Showing
4 changed files
with
106 additions
and
127 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 |
---|---|---|
@@ -1,28 +1,17 @@ | ||
import { create } from "zustand"; | ||
import { persist } from "zustand/middleware"; | ||
|
||
interface State { | ||
theme: string; | ||
language: string; | ||
} | ||
type MonacoTheme = "light" | "dark" | "hc-black" | "hc-light"; | ||
|
||
interface Actions { | ||
setTheme: (theme: string) => void; | ||
interface CodeEditorSettingsStore { | ||
language: string; | ||
setLanguage: (language: string) => void; | ||
theme: MonacoTheme; | ||
setTheme: (theme: MonacoTheme) => void; | ||
} | ||
|
||
export const useCodeEditorSettings = create<State & Actions>()( | ||
persist( | ||
(set) => { | ||
return { | ||
theme: "tokyoNight", | ||
language: "71", | ||
setTheme: (theme) => set({ theme }), | ||
setLanguage: (language) => set({ language }), | ||
}; | ||
}, | ||
{ | ||
name: "code-editor-settings", | ||
} | ||
) | ||
); | ||
export const useCodeEditorSettings = create<CodeEditorSettingsStore>((set) => ({ | ||
language: "71", | ||
setLanguage: (language) => set({ language }), | ||
theme: "dark", | ||
setTheme: (theme) => set({ theme }), | ||
})); |