mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-28 14:16:41 +07:00
added notes sidebar
This commit is contained in:
parent
fe3db608d6
commit
cedf0adcfa
14 changed files with 376 additions and 153 deletions
19
src/utils/providers/NoteProvider.tsx
Normal file
19
src/utils/providers/NoteProvider.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { createContext, FC, useContext } from "react";
|
||||
|
||||
import { useNotes } from "~/hooks/notes/useNotes";
|
||||
|
||||
const NoteContext = createContext<ReturnType<typeof useNotes>>({
|
||||
notes: [],
|
||||
hasMore: false,
|
||||
loadMore: async () => Promise.resolve(undefined),
|
||||
isLoading: false,
|
||||
submit: () => Promise.resolve(),
|
||||
});
|
||||
|
||||
export const NoteProvider: FC = ({ children }) => {
|
||||
const notes = useNotes("");
|
||||
|
||||
return <NoteContext.Provider value={notes}>{children}</NoteContext.Provider>;
|
||||
};
|
||||
|
||||
export const useNotesContext = () => useContext(NoteContext);
|
Loading…
Add table
Add a link
Reference in a new issue