mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
refactor(modals): split directory modal into separate create board modal
Separate DirectoryModal (for home view placeholders) and CreateBoardModal (for board view create button) into distinct components with their own stores, allowing independent styling and cleaner separation of concerns.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
interface CreateBoardModalState {
|
||||
showModal: boolean;
|
||||
openCreateBoardModal: () => void;
|
||||
closeCreateBoardModal: () => void;
|
||||
}
|
||||
|
||||
const useCreateBoardModalStore = create<CreateBoardModalState>((set) => ({
|
||||
showModal: false,
|
||||
|
||||
openCreateBoardModal: () => {
|
||||
set({
|
||||
showModal: true,
|
||||
});
|
||||
},
|
||||
|
||||
closeCreateBoardModal: () => {
|
||||
set({
|
||||
showModal: false,
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
||||
export default useCreateBoardModalStore;
|
||||
@@ -1,22 +1,17 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
type ModalContext = 'placeholder' | 'create-button';
|
||||
|
||||
interface DirectoryModalState {
|
||||
showModal: boolean;
|
||||
modalContext: ModalContext;
|
||||
openDirectoryModal: (context?: ModalContext) => void;
|
||||
openDirectoryModal: () => void;
|
||||
closeDirectoryModal: () => void;
|
||||
}
|
||||
|
||||
const useDirectoryModalStore = create<DirectoryModalState>((set) => ({
|
||||
showModal: false,
|
||||
modalContext: 'placeholder',
|
||||
|
||||
openDirectoryModal: (context: ModalContext = 'placeholder') => {
|
||||
openDirectoryModal: () => {
|
||||
set({
|
||||
showModal: true,
|
||||
modalContext: context,
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user