diff --git a/frontend/src/components/AddGame/AddGame.module.scss b/frontend/src/components/AddGame/AddGame.module.scss index e69de29..0a456b0 100644 --- a/frontend/src/components/AddGame/AddGame.module.scss +++ b/frontend/src/components/AddGame/AddGame.module.scss @@ -0,0 +1,63 @@ +@import 'src/styles/variables'; +.addGameContainer { + border: $border; + border-radius:$margin-smallest; + display: flex; + flex-direction: column; + min-height: 20rem; + width: 20rem; + align-self: center; + top: $margin-medium; + background-color: $color-bright; + position:absolute; + z-index:3; + padding: 1rem; +} +.button { + border: none; + border-radius: 999999rem; // Pill shaped + background-color: $color-accent; + color: $text-bright; + padding: 0.5rem 1rem; + box-shadow: $shadow; + cursor: pointer; + transition: all 200ms ease-in; + align-self: center; + + &:hover { + filter: brightness(1.2); + } + + &:active { + box-shadow: none; + filter: brightness(0.8); + } + + &:disabled { + filter: brightness(0.8); + box-shadow: none; + cursor: default; + } +} + +.lightBox { + background-color: rgba($color-dark, 0.5); + position: fixed; + top: 0; + left: 0; + right:0; + bottom: 0; + z-index: 2; +} + +.title { + font-size: $text-big; + font-weight: bold; + align-self: center; +} + +.divider { + height: 1px; + width: 100%; + background-color: $color-dark; +} \ No newline at end of file diff --git a/frontend/src/components/AddGame/AddGame.tsx b/frontend/src/components/AddGame/AddGame.tsx index c0d9b7b..7f8de1e 100644 --- a/frontend/src/components/AddGame/AddGame.tsx +++ b/frontend/src/components/AddGame/AddGame.tsx @@ -7,9 +7,12 @@ import { FieldErrors, useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import FormInput from '../Forms/FormInput/FormInput'; import FormTextArea from '../Forms/FormTextArea/FormTextArea'; -import FormSelect from '../Forms/FromSelect/FormSelect'; +import FormSelect from '../Forms/FormSelect/FormSelect'; +import styles from './AddGame.module.scss'; -interface AddGameProps {} +interface AddGameProps { + showSelf: (b: boolean) => void; +} const addGameSchema = z .object({ @@ -52,7 +55,7 @@ const addGameSchema = z type AddGameForm = z.infer; -const AddGame: FC = () => { +const AddGame: FC = ({ showSelf }) => { const { data, error, isLoading } = usePlatforms(); const { @@ -114,7 +117,15 @@ const AddGame: FC = () => { return ( <> -
+ +
{ + showSelf(false); + }} /> + { + handleSubmit(submitHandler, invalidFormHandler); + }}> +

Add new game

+
= () => { error={errors.name?.message} />
-
- { @@ -143,7 +152,6 @@ const AddGame: FC = () => { error={errors.platform?.message} />
- = () => { error={errors.releaseDate?.message} />
- = () => { error={errors.playtime?.message} />
- = () => { error={errors.playerMin?.message} />
- = () => { error={errors.playerMax?.message} />
- = () => { register={register} error={errors.location?.message} /> -
{errors.root ?

Error: {errors.root.message}

: null} - + - + ); }; diff --git a/frontend/src/components/AddSuggestion/AddSuggestion.tsx b/frontend/src/components/AddSuggestion/AddSuggestion.tsx index 0ff7341..b686e4f 100644 --- a/frontend/src/components/AddSuggestion/AddSuggestion.tsx +++ b/frontend/src/components/AddSuggestion/AddSuggestion.tsx @@ -5,7 +5,7 @@ import * as z from 'zod'; import { toast } from 'react-toastify'; import FormInput from '../Forms/FormInput/FormInput'; import FormTextArea from '../Forms/FormTextArea/FormTextArea'; -import FormSelect from '../Forms/FromSelect/FormSelect'; +import FormSelect from '../Forms/FormSelect/FormSelect'; import { useAddGameSuggestion } from '@/src/hooks/api/useAddGameSuggestion'; import { usePlatforms } from '@/src/hooks/api/usePlatforms'; diff --git a/frontend/src/components/Forms/FormInput/FormInput.module.scss b/frontend/src/components/Forms/FormInput/FormInput.module.scss new file mode 100644 index 0000000..476fd4c --- /dev/null +++ b/frontend/src/components/Forms/FormInput/FormInput.module.scss @@ -0,0 +1,23 @@ +@import 'src/styles/variables'; +.container { + display: flex; + flex-direction: column; + margin: 0 $margin-small; + padding: $margin-small 0; +} + +.inputBox{ + border:$border; + border-radius: $margin-smallest; + padding: $margin-smallest; + margin-top: $margin-smallest; + box-shadow: $shadow; + +} + +.label { + font-size: $text-normal; + font-weight: bold; + display:block; + align-self:center; +} diff --git a/frontend/src/components/Forms/FormInput/FormInput.tsx b/frontend/src/components/Forms/FormInput/FormInput.tsx index 28d38c5..6ee75b7 100644 --- a/frontend/src/components/Forms/FormInput/FormInput.tsx +++ b/frontend/src/components/Forms/FormInput/FormInput.tsx @@ -1,5 +1,6 @@ import React, { FC, InputHTMLAttributes } from 'react'; import { UseFormRegister, RegisterOptions } from 'react-hook-form'; +import styles from './FormInput.module.scss'; interface InputProps extends InputHTMLAttributes { name: string; @@ -21,9 +22,9 @@ const FormInput: FC = ({ ...rest }) => { return ( -
- {label && } - + {label && }
+ ; - wrapperClass?: string; value?: Option; } @@ -29,19 +29,19 @@ const FormSelect: FC = ({ label, control, options, - wrapperClass, value: defaultValue, ...rest }) => { return ( -
- {label && } +
+ {label && } (