diff --git a/app/frontend/src/hooks/useRouter.tsx b/app/frontend/src/hooks/useRouter.tsx index 75f2a8cba..4c72aec70 100644 --- a/app/frontend/src/hooks/useRouter.tsx +++ b/app/frontend/src/hooks/useRouter.tsx @@ -11,6 +11,7 @@ import { Groups, ProfilePage, NotFound, + GroupCreatePage, } from '@/pages'; export const useRouter = () => @@ -50,6 +51,10 @@ export const useRouter = () => path: 'groups', element: , }, + { + path: 'group/new', + element: , + }, ], }, { diff --git a/app/frontend/src/pages/Groups/Create/GroupTypeRadio.tsx b/app/frontend/src/pages/Groups/Create/GroupTypeRadio.tsx new file mode 100644 index 000000000..816f8a997 --- /dev/null +++ b/app/frontend/src/pages/Groups/Create/GroupTypeRadio.tsx @@ -0,0 +1,30 @@ +import { Control, useController } from 'react-hook-form'; + +import * as styles from './index.css'; +import { GroupCreate } from './types'; + +export function GroupTypeRadio({ control }: { control: Control }) { + const { + field: { value, onChange }, + } = useController({ + name: 'type', + control, + }); + + return ( +
+ {['public', 'private'].map((type) => ( + + ))} +
+ ); +} diff --git a/app/frontend/src/pages/Groups/Create/index.css.ts b/app/frontend/src/pages/Groups/Create/index.css.ts new file mode 100644 index 000000000..3a922fdba --- /dev/null +++ b/app/frontend/src/pages/Groups/Create/index.css.ts @@ -0,0 +1,30 @@ +import { style } from '@vanilla-extract/css'; + +import { sansRegular14 } from '@/styles/font.css'; + +export const container = style({ + display: 'flex', + flexDirection: 'column', + gap: '2.4rem', + maxWidth: '80rem', + margin: '0 auto', +}); + +export const groupWrapper = style({ + display: 'flex', + gap: '1.2rem', +}); +export const inputField = style([ + sansRegular14, + { + display: 'flex', + alignItems: 'center', + gap: '0.4rem', + }, +]); + +export const inputWrapper = style({ + display: 'flex', + flexDirection: 'column', + gap: '0.8rem', +}); diff --git a/app/frontend/src/pages/Groups/Create/index.tsx b/app/frontend/src/pages/Groups/Create/index.tsx new file mode 100644 index 000000000..b61f86323 --- /dev/null +++ b/app/frontend/src/pages/Groups/Create/index.tsx @@ -0,0 +1,62 @@ +import { useController, useForm } from 'react-hook-form'; + +import { TextLabel, Button } from '@morak/ui'; + +import { FormInput } from '@/components'; + +import { GroupTypeRadio } from './GroupTypeRadio'; +import * as styles from './index.css'; +import { GroupCreate } from './types'; + +export function GroupCreatePage() { + const { + control, + handleSubmit, + formState: { isValid }, + } = useForm({ + defaultValues: { + name: '', + type: 'public', + joinType: ['approve'], + }, + mode: 'all', + }); + + const { + field: { value: nameValue, onChange: onChangeName }, + } = useController({ + name: 'name', + control, + rules: { + required: true, + }, + }); + return ( +
console.log(data))} + > + +
+ + +
+ + + ); +} diff --git a/app/frontend/src/pages/Groups/Create/types.ts b/app/frontend/src/pages/Groups/Create/types.ts new file mode 100644 index 000000000..0e234d72b --- /dev/null +++ b/app/frontend/src/pages/Groups/Create/types.ts @@ -0,0 +1,6 @@ +export type GroupCreate = { + name: string; + type: 'public' | 'private'; + joinType: GroupJoin[]; +}; +export type GroupJoin = 'approve' | 'code'; diff --git a/app/frontend/src/pages/index.ts b/app/frontend/src/pages/index.ts index be3bc46ce..70f8f4827 100644 --- a/app/frontend/src/pages/index.ts +++ b/app/frontend/src/pages/index.ts @@ -1,5 +1,6 @@ export * from './Calendar'; export * from './Groups'; +export * from './Groups/Create'; export * from './Main'; export * from './Map'; export * from './Mogaco';