refactor: repartition server-side and client-side code
This commit is contained in:
15
app/.client/stores/sidebar.ts
Normal file
15
app/.client/stores/sidebar.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { atom } from 'nanostores';
|
||||
|
||||
export const kSidebar = 'upage_sidebar';
|
||||
|
||||
export const DEFAULT_SIDEBAR_STATE = false;
|
||||
|
||||
export const sidebarStore = atom<boolean>(DEFAULT_SIDEBAR_STATE);
|
||||
|
||||
export function toggleSidebar() {
|
||||
const currentSidebar = sidebarStore.get();
|
||||
const newSidebar = !currentSidebar;
|
||||
|
||||
// Update the theme store
|
||||
sidebarStore.set(newSidebar);
|
||||
}
|
||||
Reference in New Issue
Block a user