From 7c35bb5a5dee5f26358598688989ada1cb8e9459 Mon Sep 17 00:00:00 2001 From: memeriau Date: Wed, 23 Feb 2022 23:56:30 +0100 Subject: [PATCH] various UI improvments --- src/app/styles.module.scss | 15 ++-- src/components/ForgotForm/ForgotForm.tsx | 3 +- src/components/Form/FormButton/FormButton.tsx | 19 ++++++ .../Form/FormButton/styles.module.scss | 5 ++ src/components/Form/FormSubmit/FormSubmit.tsx | 14 ++++ .../Form/FormSubmit/styles.module.scss | 5 ++ src/components/LoginForm/index.tsx | 3 +- .../LogoutButton/styles.module.scss | 3 + src/components/Modal/Modal.tsx | 2 +- src/components/Navigation/MainMenu.tsx | 26 +++++-- src/components/Navigation/styles.module.scss | 68 +++++++++++++++++++ .../Notifications/styles.module.scss | 2 - .../DayWishes/styles.module.scss | 6 ++ .../DayWishesForm/DayWishesForm.tsx | 5 +- .../ParticipationDetails/styles.module.scss | 6 ++ .../ParticipationDetailsForm.tsx | 5 +- .../TeamWishes/styles.module.scss | 6 ++ .../TeamWishesForm/TeamWishesForm.tsx | 5 +- src/routes/index.ts | 2 +- src/theme/form.scss | 6 +- src/theme/main.scss | 7 +- src/theme/mixins.scss | 15 ++++ 22 files changed, 193 insertions(+), 35 deletions(-) create mode 100644 src/components/Form/FormButton/FormButton.tsx create mode 100644 src/components/Form/FormButton/styles.module.scss create mode 100644 src/components/Form/FormSubmit/FormSubmit.tsx create mode 100644 src/components/Form/FormSubmit/styles.module.scss diff --git a/src/app/styles.module.scss b/src/app/styles.module.scss index 0ecd07e..7f6366e 100755 --- a/src/app/styles.module.scss +++ b/src/app/styles.module.scss @@ -57,10 +57,17 @@ .menuWrapper { position: absolute; - bottom: 5px; - left: 420px; - right: 10px; - text-align: center; + top: 0; + right: 0; + bottom: 0; + + @include desktop { + top: auto; + bottom: 5px; + left: 420px; + right: 10px; + text-align: center; + } } .logoutWrapper { diff --git a/src/components/ForgotForm/ForgotForm.tsx b/src/components/ForgotForm/ForgotForm.tsx index b0fd47b..72ad494 100644 --- a/src/components/ForgotForm/ForgotForm.tsx +++ b/src/components/ForgotForm/ForgotForm.tsx @@ -3,6 +3,7 @@ import { Link } from "react-router-dom" import { AppDispatch } from "../../store" import { fetchVolunteerForgot } from "../../store/volunteerForgot" import styles from "./styles.module.scss" +import FormSubmit from "../Form/FormSubmit/FormSubmit" interface Props { dispatch: AppDispatch @@ -34,7 +35,7 @@ const ForgotForm = ({ dispatch, error, message }: Props): JSX.Element => {
- + Envoyer
{error}
{message}
diff --git a/src/components/Form/FormButton/FormButton.tsx b/src/components/Form/FormButton/FormButton.tsx new file mode 100644 index 0000000..0fbc2df --- /dev/null +++ b/src/components/Form/FormButton/FormButton.tsx @@ -0,0 +1,19 @@ +import { FC, ReactNode } from "react" +import styles from "./styles.module.scss" + +type Props = { + children: ReactNode + onClick?: () => void | undefined +} + +const FormButton: FC = ({ children, onClick }): JSX.Element => ( + +) + +FormButton.defaultProps = { + onClick: undefined, +} + +export default FormButton diff --git a/src/components/Form/FormButton/styles.module.scss b/src/components/Form/FormButton/styles.module.scss new file mode 100644 index 0000000..70bec07 --- /dev/null +++ b/src/components/Form/FormButton/styles.module.scss @@ -0,0 +1,5 @@ +@import "../../../theme/mixins"; + +.button { + @include form-button; +} diff --git a/src/components/Form/FormSubmit/FormSubmit.tsx b/src/components/Form/FormSubmit/FormSubmit.tsx new file mode 100644 index 0000000..06d1823 --- /dev/null +++ b/src/components/Form/FormSubmit/FormSubmit.tsx @@ -0,0 +1,14 @@ +import { FC, ReactNode } from "react" +import styles from "./styles.module.scss" + +type Props = { + children: ReactNode +} + +const FormSubmit: FC = ({ children }): JSX.Element => ( + +) + +export default FormSubmit diff --git a/src/components/Form/FormSubmit/styles.module.scss b/src/components/Form/FormSubmit/styles.module.scss new file mode 100644 index 0000000..70bec07 --- /dev/null +++ b/src/components/Form/FormSubmit/styles.module.scss @@ -0,0 +1,5 @@ +@import "../../../theme/mixins"; + +.button { + @include form-button; +} diff --git a/src/components/LoginForm/index.tsx b/src/components/LoginForm/index.tsx index 772a071..e06906c 100644 --- a/src/components/LoginForm/index.tsx +++ b/src/components/LoginForm/index.tsx @@ -4,6 +4,7 @@ import { shallowEqual, useDispatch, useSelector } from "react-redux" import { AppState } from "../../store" import { fetchVolunteerLogin } from "../../store/volunteerLogin" import styles from "./styles.module.scss" +import FormSubmit from "../Form/FormSubmit/FormSubmit" const LoginForm = (): JSX.Element => { const dispatch = useDispatch() @@ -38,7 +39,7 @@ const LoginForm = (): JSX.Element => {
- + Connexion
{loginError &&
{loginError}
}
diff --git a/src/components/LogoutButton/styles.module.scss b/src/components/LogoutButton/styles.module.scss index c4e4b24..ef244cc 100644 --- a/src/components/LogoutButton/styles.module.scss +++ b/src/components/LogoutButton/styles.module.scss @@ -1,3 +1,5 @@ +@import "../../theme/variables"; + .logoutButton { text-align: center; @@ -6,5 +8,6 @@ background: none; font-weight: normal; font-size: 0.9em; + color: $color-white; } } diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index f5ef499..b7cf082 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -27,7 +27,7 @@ const Modal: FC = ({ modalId, children }): JSX.Element => { overlayClassName={styles.modalOverlay} onRequestClose={onClose} > - {children} diff --git a/src/components/Navigation/MainMenu.tsx b/src/components/Navigation/MainMenu.tsx index 1d1e9e3..e03bbc1 100644 --- a/src/components/Navigation/MainMenu.tsx +++ b/src/components/Navigation/MainMenu.tsx @@ -1,25 +1,41 @@ -import { FC } from "react" +import { FC, useCallback, useState } from "react" import { useSelector } from "react-redux" +import classnames from "classnames" import { isUserConnected } from "../../store/auth" import styles from "./styles.module.scss" const MainMenu: FC = (): JSX.Element | null => { const connected = useSelector(isUserConnected) + const [opened, setOpened] = useState(false) + + const onOpen = useCallback(() => { + setOpened(true) + }, [setOpened]) + + const onClose = useCallback(() => { + setOpened(false) + }, [setOpened]) if (!connected) return null return ( ) diff --git a/src/components/Navigation/styles.module.scss b/src/components/Navigation/styles.module.scss index 1c6a2ac..7c4fdf4 100644 --- a/src/components/Navigation/styles.module.scss +++ b/src/components/Navigation/styles.module.scss @@ -1,20 +1,88 @@ @import "../../theme/variables"; +@import "../../theme/mixins"; .mainMenu { margin: 0; padding: 0; list-style: none; + + @include mobile { + position: fixed; + top: 0; + bottom: 0; + right: -260px; + width: 250px; + padding-top: 40px; + background-color: $color-white; + box-shadow: 0 0 8px $color-grey-dark; + transition: right 0.6s ease; + z-index: 10; + } + + &.opened { + @include mobile { + right: 0; + } + } +} + +.close { + display: none; + position: absolute; + top: 5px; + right: 5px; + width: 30px; + height: 30px; + line-height: 30px; + text-align: center; + font-size: 26px; + color: $color-grey-medium; + + @include mobile { + display: block; + } +} + +.burger { + display: none; + + @include mobile { + display: block; + position: absolute; + right: 10px; + width: 30px; + height: 30px; + text-align: center; + font-size: 22px; + color: $color-black; + + @include vertical-center(); + } } .mainMenuItem { display: inline-block; margin: 0 6px; + @include mobile { + display: block; + border-bottom: 1px solid $color-grey-light; + + &:first-child { + border-top: 1px solid $color-grey-light; + } + } + a { font-size: 0.9em; font-weight: bold; color: $color-black; text-decoration: none; + + @include mobile { + display: block; + padding: 10px 15px; + } } a:hover { diff --git a/src/components/Notifications/styles.module.scss b/src/components/Notifications/styles.module.scss index 379b293..a83d092 100755 --- a/src/components/Notifications/styles.module.scss +++ b/src/components/Notifications/styles.module.scss @@ -15,8 +15,6 @@ .pushNotificationsContent { @include page-content-wrapper; - - background-color: #ece3df; } .notifIntro { diff --git a/src/components/VolunteerBoard/DayWishes/styles.module.scss b/src/components/VolunteerBoard/DayWishes/styles.module.scss index 8965534..2e5f96f 100755 --- a/src/components/VolunteerBoard/DayWishes/styles.module.scss +++ b/src/components/VolunteerBoard/DayWishes/styles.module.scss @@ -37,4 +37,10 @@ position: absolute; right: 20px; + + button { + color: $color-green; + font-weight: bold; + cursor: pointer; + } } diff --git a/src/components/VolunteerBoard/DayWishesForm/DayWishesForm.tsx b/src/components/VolunteerBoard/DayWishesForm/DayWishesForm.tsx index 3ecc404..7d40c90 100644 --- a/src/components/VolunteerBoard/DayWishesForm/DayWishesForm.tsx +++ b/src/components/VolunteerBoard/DayWishesForm/DayWishesForm.tsx @@ -9,6 +9,7 @@ import { selectionChoices, useUserDayWishes, } from "../daysWishes.utils" +import FormButton from "../../Form/FormButton/FormButton" type Props = { afterSubmit?: () => void | undefined @@ -72,9 +73,7 @@ const DayWishesForm: FC = ({ afterSubmit }): JSX.Element => {