From 1c1c9b06112dbfef00c091680128864f8e3338a3 Mon Sep 17 00:00:00 2001 From: chip Date: Fri, 30 Oct 2020 00:06:27 +0100 Subject: [PATCH] feat(notes/nui): New hook and state for NoteItem details --- phone/src/apps/notes/hooks/state.ts | 6 +++++- phone/src/apps/notes/hooks/useNoteDetail.ts | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 phone/src/apps/notes/hooks/useNoteDetail.ts diff --git a/phone/src/apps/notes/hooks/state.ts b/phone/src/apps/notes/hooks/state.ts index 4b873e8..9599aa0 100644 --- a/phone/src/apps/notes/hooks/state.ts +++ b/phone/src/apps/notes/hooks/state.ts @@ -7,6 +7,10 @@ export const noteStates = { }), noteModal: atom({ key: 'noteModal', - default: true + default: false + }), + noteDetail: atom({ + key: 'noteDetail', + default: null }) } \ No newline at end of file diff --git a/phone/src/apps/notes/hooks/useNoteDetail.ts b/phone/src/apps/notes/hooks/useNoteDetail.ts new file mode 100644 index 0000000..9faab1e --- /dev/null +++ b/phone/src/apps/notes/hooks/useNoteDetail.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { noteStates } from './state'; + +export const useNoteDetail = (): any => { + const [detail, setDetail] = useRecoilState(noteStates.noteDetail); + return { detail, setDetail }; +} \ No newline at end of file