From 653afd61ad969311165ec618f5d3a7bda7c9375d Mon Sep 17 00:00:00 2001 From: Eric Kojo Abbey Date: Thu, 25 Nov 2021 17:31:56 +0000 Subject: [PATCH 1/2] worked on memories add --- src/Components/AddMemory/index.tsx | 187 ++++++++++++++++++++++++++ src/Components/Forms/FormTextArea.tsx | 19 ++- src/Components/Memories/index.tsx | 11 +- src/Views/Memories/index.tsx | 13 +- 4 files changed, 222 insertions(+), 8 deletions(-) create mode 100644 src/Components/AddMemory/index.tsx diff --git a/src/Components/AddMemory/index.tsx b/src/Components/AddMemory/index.tsx new file mode 100644 index 0000000..41e6c4c --- /dev/null +++ b/src/Components/AddMemory/index.tsx @@ -0,0 +1,187 @@ +import { FC } from 'react' +import { useFormik } from 'formik' +import { Box, Icon, Grid, Flex, GridItem } from '@chakra-ui/react' +import { FilledButton } from 'Components/Buttons' +import { FileUpload, Input, TextArea } from 'Components/Forms' +import { Views } from 'Views/Memories' +import useAuth from 'Utils/Providers/AuthContextProvider' + +import { IUser } from 'Interfaces/auth.interface' +import Thumb from 'Components/Thumb' +import { authStore } from 'Stores/auth.store' + +import Avatar from 'Assets/Images/avatar.png' +import { FiEdit2 } from 'react-icons/fi' + +const AddMemory: FC<{ isAdd?: boolean; toggle?: (e: Views) => void }> = ({ + isAdd, + toggle +}) => { + const { isLoading, login } = useAuth() + + const user = authStore(state => state.user) + + interface IUser { + avatar: any + email: string + firstName: string + lastName: string + password?: string + phoneNumber: string + gender?: string + address?: string + occupation?: string + dob?: string + race?: string + country?: string + tribe?: string + religion?: string + } + + interface IMemory { + name: string + location: string + date: string + member: string + file: string + note: '' + } + + const formik = useFormik({ + initialValues: { + name: '', + location: '', + date: '', + member: '', + file: '', + note: '' + }, + onSubmit: async values => { + // await login(values) + } + }) + + return ( +
+ + + + + + + + + + + + + + + + {isAdd ? ( + <> + + + {toggle && ( + toggle('view')} + /> + )} + + ) : ( + + )} + +
+ ) +} + +export default AddMemory diff --git a/src/Components/Forms/FormTextArea.tsx b/src/Components/Forms/FormTextArea.tsx index fcf5bd3..bd1afe8 100644 --- a/src/Components/Forms/FormTextArea.tsx +++ b/src/Components/Forms/FormTextArea.tsx @@ -20,8 +20,23 @@ const FormTextArea: FC = ({ }) => { return ( - {label} -