diff --git a/phone/src/apps/notes/NotesApp.css b/phone/src/apps/notes/NotesApp.css new file mode 100644 index 0000000..55d7f7e --- /dev/null +++ b/phone/src/apps/notes/NotesApp.css @@ -0,0 +1,3 @@ +#notes-app.Mui-Selected:focus { + border-bottom: 2px solid #f9a825; +} \ No newline at end of file diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx new file mode 100644 index 0000000..4357508 --- /dev/null +++ b/phone/src/apps/notes/NotesApp.tsx @@ -0,0 +1,46 @@ +import React from 'react' +import { AppWrapper } from '../../ui/components/AppWrapper'; +import { AppContent } from '../../ui/components/AppContent'; +import NotesTitle from './NotesTitle'; +import NoteList from './list/NoteList'; + + +import { useNotes } from './hooks/useNotes'; +import { AddNoteModal } from './modal/AddNoteModal'; +import { Button, Fab } from '@material-ui/core'; +import AddIcon from '@material-ui/icons/Add'; + +import { useNoteModal } from './hooks/useNoteModal'; + +import useStyles from './notes.styles'; + +export const NotesApp = () => { + const { noteModal, setNoteModal } = useNoteModal(); + const notes = useNotes(); + + const classes = useStyles(); + + const handleModal = () => { + setNoteModal(true) + } + + return ( + + + +
+ + + + + + + + ) +} diff --git a/phone/src/apps/notes/NotesTitle.tsx b/phone/src/apps/notes/NotesTitle.tsx new file mode 100644 index 0000000..5cdfb0b --- /dev/null +++ b/phone/src/apps/notes/NotesTitle.tsx @@ -0,0 +1,18 @@ +import React from 'react' + +import useStyles from './notes.styles'; + +import { Paper } from "@material-ui/core"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faStickyNote } from "@fortawesome/free-solid-svg-icons"; + +const NotesTitle = () => { + const classes = useStyles() + return ( + + + + ) +} + +export default NotesTitle; \ No newline at end of file diff --git a/phone/src/apps/notes/hooks/state.ts b/phone/src/apps/notes/hooks/state.ts new file mode 100644 index 0000000..4b873e8 --- /dev/null +++ b/phone/src/apps/notes/hooks/state.ts @@ -0,0 +1,12 @@ +import { atom } from 'recoil'; + +export const noteStates = { + noteItems: atom({ + key: 'noteItem', + default: [] + }), + noteModal: atom({ + key: 'noteModal', + default: true + }) +} \ No newline at end of file diff --git a/phone/src/apps/notes/hooks/useNoteModal.ts b/phone/src/apps/notes/hooks/useNoteModal.ts new file mode 100644 index 0000000..adbcc9a --- /dev/null +++ b/phone/src/apps/notes/hooks/useNoteModal.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { noteStates } from './state'; + +export const useNoteModal = () => { + const [noteModal, setNoteModal] = useRecoilState(noteStates.noteModal); + return { noteModal, setNoteModal }; +} \ No newline at end of file diff --git a/phone/src/apps/notes/hooks/useNotes.ts b/phone/src/apps/notes/hooks/useNotes.ts new file mode 100644 index 0000000..69ce277 --- /dev/null +++ b/phone/src/apps/notes/hooks/useNotes.ts @@ -0,0 +1,7 @@ +import { useRecoilValue } from 'recoil'; +import { noteStates } from './state'; + +export const useNotes = () => { + const notes = useRecoilValue(noteStates.noteItems); + return notes; +} diff --git a/phone/src/apps/notes/hooks/useNotesService.ts b/phone/src/apps/notes/hooks/useNotesService.ts new file mode 100644 index 0000000..3b7df58 --- /dev/null +++ b/phone/src/apps/notes/hooks/useNotesService.ts @@ -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(); +} \ No newline at end of file diff --git a/phone/src/apps/notes/list/NoteItem.tsx b/phone/src/apps/notes/list/NoteItem.tsx new file mode 100644 index 0000000..738cbeb --- /dev/null +++ b/phone/src/apps/notes/list/NoteItem.tsx @@ -0,0 +1,10 @@ +import { ListItem, ListItemText } from '@material-ui/core' +import React from 'react' + +export const NoteItem = (note) => { + return ( + + {note.title} + + ) +} diff --git a/phone/src/apps/notes/list/NoteList.tsx b/phone/src/apps/notes/list/NoteList.tsx new file mode 100644 index 0000000..446e0d7 --- /dev/null +++ b/phone/src/apps/notes/list/NoteList.tsx @@ -0,0 +1,16 @@ +import { List } from '@material-ui/core'; +import React from 'react' +import { NoteItem } from './NoteItem'; + +// add search bar later +const NoteList = ({notes}) => { + return ( + + {notes.map((note) => ( + + ))} + + ) +} + +export default NoteList; diff --git a/phone/src/apps/notes/modal/AddNoteModal.tsx b/phone/src/apps/notes/modal/AddNoteModal.tsx new file mode 100644 index 0000000..ad50de4 --- /dev/null +++ b/phone/src/apps/notes/modal/AddNoteModal.tsx @@ -0,0 +1,57 @@ +import { Button, List, ListItem, TextField } from '@material-ui/core'; +import React, { useState } from 'react' +import Modal from '../../../ui/components/Modal'; +import ClearIcon from "@material-ui/icons/Clear"; + +import { useNoteModal } from '../hooks/useNoteModal'; +import useStyles from './modal.styles'; + +import '../NotesApp.css' + +export const AddNoteModal = () => { + const [title, setTitle] = useState(''); + const [content, setContent] = useState(''); + + const classes = useStyles(); + + const {noteModal, setNoteModal} = useNoteModal(); + + const _handleClose = () => { + setNoteModal(false); + } + + return ( + + + + + setTitle(e.target.value)} + /> + + + setContent(e.target.value)} + variant="outlined" + multiline + inputProps={{ + className: classes.inputStyles + }} + /> + + + + ) +} diff --git a/phone/src/apps/notes/modal/modal.styles.ts b/phone/src/apps/notes/modal/modal.styles.ts new file mode 100644 index 0000000..f1d2936 --- /dev/null +++ b/phone/src/apps/notes/modal/modal.styles.ts @@ -0,0 +1,17 @@ +import { makeStyles } from '@material-ui/core'; + +const useStyles = makeStyles((theme) => ({ + closeButton: { + width: '10%', + position: 'absolute', + right: 0 + }, + input: { + + }, + inputStyles: { + + } +})) + +export default useStyles; \ No newline at end of file diff --git a/phone/src/apps/notes/notes.styles.ts b/phone/src/apps/notes/notes.styles.ts new file mode 100644 index 0000000..8cd6850 --- /dev/null +++ b/phone/src/apps/notes/notes.styles.ts @@ -0,0 +1,25 @@ +import { makeStyles } from '@material-ui/core'; + +const useStyles = makeStyles((theme) => ({ + header: { + width: '100%', + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'center', + alignItems: 'center', + textAlign: 'center', + height: '60px' + }, + backgroundModal: { + background: "black", + opacity: "0.6", + position: "absolute", + top: 0, + left: 0, + right: 0, + bottom: 0, + zIndex: 5, + }, +})) + +export default useStyles; \ No newline at end of file