From 1926a54d1f7b8bc1ed690aaf8e3b679b41edce7b Mon Sep 17 00:00:00 2001 From: rohan09-raj Date: Sat, 20 Aug 2022 21:52:57 +0530 Subject: enrollment improvements --- client/src/App.js | 2 + client/src/components/Input/Input.module.css | 3 +- .../components/LanguageSelect/LanguageSelect.js | 67 --------- .../components/LanguageSelect/LanguageSelect.jsx | 69 ++++++++++ .../LanguageSelect/LanguageSelect.module.css | 5 + client/src/components/Modal/Modal.jsx | 36 +++-- client/src/components/Modal/Modal.module.css | 16 +++ client/src/pages/Enrollment/Address/Address.jsx | 152 ++++++++++----------- .../pages/Enrollment/Address/Address.module.css | 17 +-- .../src/pages/Enrollment/Agreement/Agreement.jsx | 3 +- client/src/pages/Enrollment/Enrollment.jsx | 81 ++++++----- client/src/pages/Enrollment/Enrollment.module.css | 0 .../pages/Enrollment/FormOne/FormOne.module.css | 7 + client/src/pages/Enrollment/FormTwo/FormTwo.jsx | 64 ++++----- .../pages/Enrollment/FormTwo/FormTwo.module.css | 4 +- client/src/pages/Error/Error.jsx | 28 ++++ client/src/pages/Error/Error.module.css | 18 +++ client/src/pages/Home/Home.jsx | 4 +- client/src/routes/index.js | 7 + 19 files changed, 340 insertions(+), 243 deletions(-) delete mode 100644 client/src/components/LanguageSelect/LanguageSelect.js create mode 100644 client/src/components/LanguageSelect/LanguageSelect.jsx create mode 100644 client/src/components/LanguageSelect/LanguageSelect.module.css create mode 100644 client/src/components/Modal/Modal.module.css delete mode 100644 client/src/pages/Enrollment/Enrollment.module.css create mode 100644 client/src/pages/Error/Error.jsx create mode 100644 client/src/pages/Error/Error.module.css (limited to 'client/src') diff --git a/client/src/App.js b/client/src/App.js index c39f14e..0d6d904 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,9 +1,11 @@ import React from 'react' +import LanguageSelect from './components/LanguageSelect/LanguageSelect' import Index from './routes' const App = () => { return ( <> + ) diff --git a/client/src/components/Input/Input.module.css b/client/src/components/Input/Input.module.css index b02591c..59867e9 100644 --- a/client/src/components/Input/Input.module.css +++ b/client/src/components/Input/Input.module.css @@ -2,6 +2,7 @@ display: flex; justify-content: center; font-family: 'Barlow'; + margin: 15px 0px; font-size: var(--font-medium-s); } @@ -11,7 +12,7 @@ } .input__field { - width: 300px; + width: 330px; margin: 10px 0px; padding: 18px 10px; border: 3px solid; diff --git a/client/src/components/LanguageSelect/LanguageSelect.js b/client/src/components/LanguageSelect/LanguageSelect.js deleted file mode 100644 index ac455b8..0000000 --- a/client/src/components/LanguageSelect/LanguageSelect.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react' -import { useTranslation } from 'react-i18next' -import i18next from 'i18next' - -import ArrowDropDown from '@mui/icons-material/ArrowDropDown' -import Button from '@mui/material/Button' -import Popover from '@mui/material/Popover' -import List from '@mui/material/List' -import ListItem from '@mui/material/ListItem' -import ListSubheader from '@mui/material/ListSubheader' - -const languageMap = { - en: { label: 'English', dir: 'ltr', active: true }, - hi: { label: 'Hindi', dir: 'ltr', active: false } -} - -const LanguageSelect = () => { - const selected = localStorage.getItem('i18nextLng') || 'en' - const { t } = useTranslation() - - const [menuAnchor, setMenuAnchor] = React.useState(null) - React.useEffect(() => { - document.body.dir = languageMap[selected]?.dir - }, [menuAnchor, selected]) - - return ( -
- - setMenuAnchor(null)} - anchorOrigin={{ - vertical: 'bottom', - horizontal: 'right' - }} - transformOrigin={{ - vertical: 'top', - horizontal: 'right' - }} - > -
- - {t('select_language')} - {Object.keys(languageMap)?.map((item) => ( - { - i18next.changeLanguage(item) - setMenuAnchor(null) - }} - > - {languageMap[item].label} - - ))} - -
-
-
- ) -} - -export default LanguageSelect diff --git a/client/src/components/LanguageSelect/LanguageSelect.jsx b/client/src/components/LanguageSelect/LanguageSelect.jsx new file mode 100644 index 0000000..dd2997f --- /dev/null +++ b/client/src/components/LanguageSelect/LanguageSelect.jsx @@ -0,0 +1,69 @@ +import React, { useState, useEffect } from 'react' +import { useTranslation } from 'react-i18next' +import i18next from 'i18next' +import { Button, Popover, List, ListItem, ListSubheader } from '@mui/material' + +import styles from './LanguageSelect.module.css' + +const languageMap = { + en: { label: 'English', dir: 'ltr', active: true }, + hi: { label: 'Hindi', dir: 'ltr', active: false } +} + +const LanguageSelect = () => { + const selected = localStorage.getItem('i18nextLng') || 'en' + const { t } = useTranslation() + + const [menuAnchor, setMenuAnchor] = useState(null) + useEffect(() => { + document.body.dir = languageMap[selected]?.dir + }, [menuAnchor, selected]) + + return ( +
+ + setMenuAnchor(null)} + anchorOrigin={{ + vertical: 'bottom', + horizontal: 'right' + }} + transformOrigin={{ + vertical: 'top', + horizontal: 'right' + }} + > +
+ + {t('SELECT_LANGUAGE')} + {Object.keys(languageMap)?.map((item) => ( + { + i18next.changeLanguage(item) + setMenuAnchor(null) + }} + > + {languageMap[item].label} + + ))} + +
+
+
+ ) +} + +export default LanguageSelect diff --git a/client/src/components/LanguageSelect/LanguageSelect.module.css b/client/src/components/LanguageSelect/LanguageSelect.module.css new file mode 100644 index 0000000..9a4029c --- /dev/null +++ b/client/src/components/LanguageSelect/LanguageSelect.module.css @@ -0,0 +1,5 @@ +.language { + position: absolute; + top: 100px; + right: 150px; +} diff --git a/client/src/components/Modal/Modal.jsx b/client/src/components/Modal/Modal.jsx index 312d01e..57cb9bb 100644 --- a/client/src/components/Modal/Modal.jsx +++ b/client/src/components/Modal/Modal.jsx @@ -1,7 +1,9 @@ import React from 'react' -import { Modal, Typography, Box, Button } from '@mui/material' +import { Modal, Box, Button } from '@mui/material' +import styles from './Modal.module.css' +import { Container } from '@mui/system' -const PopUpModal = () => { +const PopUpModal = ({ title, description, image }) => { const style = { position: 'absolute', top: '50%', @@ -18,8 +20,14 @@ const PopUpModal = () => { const handleClose = () => setOpen(false) return ( - <> - +
+ { aria-describedby="modal-modal-description" > - - Text in a modal - - - Duis mollis, est non commodo luctus, nisi erat porttitor ligula. - +

+ {title} +

+ + +

{description}

+
- +
) } diff --git a/client/src/components/Modal/Modal.module.css b/client/src/components/Modal/Modal.module.css new file mode 100644 index 0000000..547445b --- /dev/null +++ b/client/src/components/Modal/Modal.module.css @@ -0,0 +1,16 @@ +.modal { + margin: 0px 15px; +} + +.modal__title { + text-align: center; + margin: 20px 0px 40px; +} + +.modal__image { + width: 40%; +} + +.modal__content { + width: 60%; +} diff --git a/client/src/pages/Enrollment/Address/Address.jsx b/client/src/pages/Enrollment/Address/Address.jsx index 9ae1857..3d1c520 100644 --- a/client/src/pages/Enrollment/Address/Address.jsx +++ b/client/src/pages/Enrollment/Address/Address.jsx @@ -4,9 +4,9 @@ import Input from '../../../components/Input/Input' import { State, City } from 'country-state-city' import Select from 'react-select' import { userContext } from '../../../context/User' +import { useTranslation } from 'react-i18next' import styles from './Address.module.css' -import { useTranslation } from 'react-i18next' const Address = () => { const { t } = useTranslation() @@ -26,7 +26,7 @@ const Address = () => { })) const customStyles = { - control: (base, state) => ({ + control: (base) => ({ ...base, width: '330px', height: '60px', @@ -34,7 +34,7 @@ const Address = () => { border: '3px solid', borderRadius: '10px !important' }), - input: (base, state) => ({ + input: (base) => ({ ...base, display: 'flex', justifyContent: 'center', @@ -48,66 +48,6 @@ const Address = () => { <>
-
-
-
- - { - setUserData({ - ...userData, - address: { - ...userData.address, - district: e - } - }) - }} - styles={customStyles} - /> -
-
- { - setUserData({ - ...userData, - address: { - ...userData.address, - village: e.target.value - } - }) - }} - placeholder={t('ENTER_YOUR_VILLAGE_TOWN')} - /> -
{ placeholder={t('ENTER_YOUR_HOUSE_NUMBER_APARTMENT')} /> { setUserData({ ...userData, address: { ...userData.address, - street: e.target.value + village: e.target.value } }) }} - placeholder={t('ENTER_YOUR_STREET_ROAD')} + placeholder={t('ENTER_YOUR_VILLAGE_TOWN')} /> +
+ + { setUserData({ ...userData, address: { ...userData.address, - locality: e.target.value + street: e.target.value } }) }} - placeholder={t('ENTER_YOUR_AREA_LOCALITY')} + placeholder={t('ENTER_YOUR_STREET_ROAD')} /> { }} placeholder={t('ENTER_YOUR_AREA_POST_OFFICE')} /> +
+ + { setUserData({ ...userData, address: { ...userData.address, - landmark: e.target.value + locality: e.target.value } }) }} - placeholder={t('ENTER_ANY_NEAREST_LANDMARK')} + placeholder={t('ENTER_YOUR_AREA_LOCALITY')} /> { }} placeholder={t('ENTER_YOUR_AREA_PINCODE')} /> + { + setUserData({ + ...userData, + address: { + ...userData.address, + landmark: e.target.value + } + }) + }} + placeholder={t('ENTER_ANY_NEAREST_LANDMARK')} + />
diff --git a/client/src/pages/Enrollment/Address/Address.module.css b/client/src/pages/Enrollment/Address/Address.module.css index 26ca909..eafa781 100644 --- a/client/src/pages/Enrollment/Address/Address.module.css +++ b/client/src/pages/Enrollment/Address/Address.module.css @@ -1,28 +1,17 @@ .address { display: flex; justify-content: center; + margin: 40px 0px 0px; } .address__container { margin: 0px 20px; } -.input { +.input__container { display: flex; justify-content: center; + flex-direction: column; font-family: 'Barlow'; font-size: var(--font-medium-s); } - -.input__container { - display: flex; - flex-direction: column; -} - -.input__field { - width: 300px; - margin: 10px 0px; - padding: 20px 10px; - border: 3px solid; - border-radius: 10px; -} diff --git a/client/src/pages/Enrollment/Agreement/Agreement.jsx b/client/src/pages/Enrollment/Agreement/Agreement.jsx index d3a5b90..7b1b9c6 100644 --- a/client/src/pages/Enrollment/Agreement/Agreement.jsx +++ b/client/src/pages/Enrollment/Agreement/Agreement.jsx @@ -81,10 +81,11 @@ const Agreement = ({ unverified, setUnverified }) => { {show && ( <> setOtp(e.target.value)} + maxLength="6" placeholder="XXXXXX" />