@@ -4,7 +4,6 @@ import { useCreateGroupMutation } from "../../graphql/generated/graphql-types";
44import { GET_ALL_MY_GROUPS } from "../../graphql/operations/groupOperations" ;
55import { groupCreationFormValidation } from "../../hooks/formValidationRules" ;
66import { useSanitizedForm } from "../../hooks/useSanitizedForm" ;
7- import Button from "../utils/Button" ;
87import Icon from "../utils/Icon" ;
98import Input from "../utils/Input" ;
109import InputWithToggle from "../utils/InputWithToggle" ;
@@ -15,9 +14,10 @@ import GroupLink from "./GroupLink";
1514
1615type CreateGroupFormProps = {
1716 onSuccess ?: ( ) => void ;
17+ onCancel ?: ( ) => void ;
1818} ;
1919
20- export default function CreateGroupForm ( { onSuccess } : CreateGroupFormProps ) {
20+ export default function CreateGroupForm ( { onSuccess, onCancel } : CreateGroupFormProps ) {
2121 const options = [
2222 {
2323 label : "Anniversaire" ,
@@ -121,14 +121,18 @@ export default function CreateGroupForm({ onSuccess }: CreateGroupFormProps) {
121121 }
122122
123123 return (
124- < form className = " flex w-full h-full rounded-2xl" onSubmit = { handleSubmit } autoComplete = "off" >
125- < div className = "bg-green w-1/2 h-full flex flex-col justify-center pt-10 pb-5 rounded-tl-2xl rounded-bl-2xl" >
124+ < form
125+ className = "flex w-full h-full rounded-2xl max-md:flex-col max-md:bg-green max-md:rounded-none max-md:overflow-y-auto max-md:p-8 max-md:justify-center"
126+ onSubmit = { handleSubmit }
127+ autoComplete = "off"
128+ >
129+ < div className = "bg-green w-1/2 h-full flex flex-col justify-center pt-10 pb-5 rounded-tl-2xl rounded-bl-2xl max-md:w-full max-md:rounded-none max-md:pt-0 max-md:pb-0" >
126130 { /* Form to create a new group */ }
127- < Subtitle className = "text-center text-2xl" > Créer un groupe</ Subtitle >
128- < div className = "text-white text-8xl m-auto" >
131+ < Subtitle className = "text-center text-2xl max-md:text-xl max-md:mb-10 " > Créer un groupe</ Subtitle >
132+ < div className = "text-white text-8xl m-auto max-md:hidden " >
129133 < Icon icon = "image" />
130134 </ div >
131- < div className = "flex flex-col gap-4 px-20" >
135+ < div className = "flex flex-col gap-4 px-20 max-md:px-0 " >
132136 < Input
133137 name = "name"
134138 type = "text"
@@ -154,16 +158,6 @@ export default function CreateGroupForm({ onSuccess }: CreateGroupFormProps) {
154158 theme = "light"
155159 />
156160
157- < Input
158- name = "piggy_bank"
159- type = "number"
160- value = { String ( formData . piggy_bank ) }
161- onChange = { handleChange }
162- placeholder = { String ( 0 ) }
163- error = { errors . piggy_bank }
164- icon = "dollar"
165- />
166-
167161 < InputWithToggle
168162 checked = { checked }
169163 onCheckedChange = { ( ) => {
@@ -185,20 +179,28 @@ export default function CreateGroupForm({ onSuccess }: CreateGroupFormProps) {
185179 error = { errors . deadline }
186180 />
187181 </ div >
188- < Button
189- type = "submit"
190- text = "Créer le groupe"
191- className = "text-center w-fit px-8 py-1 m-auto text-lg"
192- colour = "dark"
193- rounded
194- >
195- Créer
196- </ Button >
182+ < div className = "flex flex-col gap-6 max-md:w-full max-md:mt-8" >
183+ < button
184+ type = "submit"
185+ className = "bg-dark text-white font-inter-extra-bold rounded-lg py-2 px-8 w-fit m-auto text-lg shadow-md hover:brightness-110 max-md:w-full max-md:py-3 max-md:rounded-full max-md:text-base max-md:font-bold max-md:shadow-[0_2px_6px_rgba(32,9,4,0.2)] max-md:bg-white max-md:text-dark max-md:hover:bg-gray-100"
186+ >
187+ Créer le groupe
188+ </ button >
189+ { onCancel && (
190+ < button
191+ type = "button"
192+ onClick = { onCancel }
193+ className = "hidden max-md:block w-full py-3 rounded-full bg-dark text-white text-base font-bold shadow-[0_2px_6px_rgba(32,9,4,0.2)] hover:bg-[#463835]"
194+ >
195+ Annuler
196+ </ button >
197+ ) }
198+ </ div >
197199 { error && < p className = "text-orange font-inter text-sm pt-1 text-center" > { error } </ p > }
198200 { errors . main && < p className = "text-orange font-inter text-sm pt-1 text-center" > { errors . main } </ p > }
199201 </ div >
200202
201- < div className = "w-1/2 bg-white max-md:w- full flex flex-col max-md: rounded-none rounded- tr-2xl rounded-br-2xl" >
203+ < div className = "w-1/2 bg-white h- full flex flex-col rounded-tr-2xl rounded-br-2xl max-md:hidden " >
202204 < div className = "flex flex-col gap-4 px-20 m-auto" >
203205 { /* Adding users can go here */ }
204206 < div className = "flex flex-row items-center w-full border border-blue" >
0 commit comments