mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
feat(notes/nui): Notes initial commit
This commit is contained in:
1 parent
3f6600c28c
commit
f1aea97cc4
12 files changed
+228
No files matched your search
@@ -0,0 +1,12 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const noteStates = {
|
||||
noteItems: atom({
|
||||
key: 'noteItem',
|
||||
default: []
|
||||
}),
|
||||
noteModal: atom({
|
||||
key: 'noteModal',
|
||||
default: true
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { noteStates } from './state';
|
||||
|
||||
export const useNoteModal = () => {
|
||||
const [noteModal, setNoteModal] = useRecoilState(noteStates.noteModal);
|
||||
return { noteModal, setNoteModal };
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { noteStates } from './state';
|
||||
|
||||
export const useNotes = () => {
|
||||
const notes = useRecoilValue(noteStates.noteItems);
|
||||
return notes;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { useSetRecoilState } from 'recoil'
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { useNotes } from './useNotes';
|
||||
import { noteStates } from './state';
|
||||
|
||||
export const useNotesService = () => {
|
||||
const setNotes = useSetRecoilState(noteStates.noteItems);
|
||||
useNuiEvent('NOTES', 'setNotes', setNotes);
|
||||
return useNotes();
|
||||
}
|
||||
Reference in new issue
Block a user