@@ -6,12 +6,14 @@ import * as Yup from "yup";
6
6
import { isApiValidationError } from "api/errors" ;
7
7
import type { CreateGroupRequest } from "api/typesGenerated" ;
8
8
import { ErrorAlert } from "components/Alert/ErrorAlert" ;
9
- import { FormFooter } from "components/FormFooter/FormFooter" ;
10
- import { FullPageForm } from "components/FullPageForm/FullPageForm" ;
11
9
import { IconField } from "components/IconField/IconField" ;
12
- import { Margins } from "components/Margins/Margins" ;
13
- import { Stack } from "components/Stack/Stack" ;
14
10
import { getFormHelpers , onChangeTrimmed } from "utils/formUtils" ;
11
+ import {
12
+ FormFields ,
13
+ FormFooter ,
14
+ FormSection ,
15
+ HorizontalForm ,
16
+ } from "components/Form/Form" ;
15
17
16
18
const validationSchema = Yup . object ( {
17
19
name : Yup . string ( ) . required ( ) . label ( "Name" ) ,
@@ -47,39 +49,40 @@ export const CreateGroupPageView: FC<CreateGroupPageViewProps> = ({
47
49
const onCancel = ( ) => navigate ( - 1 ) ;
48
50
49
51
return (
50
- < Margins >
51
- < FullPageForm title = "Create group" >
52
- < form onSubmit = { form . handleSubmit } >
53
- < Stack spacing = { 2.5 } >
54
- { Boolean ( error ) && ! isApiValidationError ( error ) && (
55
- < ErrorAlert error = { error } />
56
- ) }
52
+ < HorizontalForm onSubmit = { form . handleSubmit } >
53
+ < FormSection
54
+ title = "Group settings"
55
+ description = "Set a name and avatar for this group."
56
+ >
57
+ < FormFields >
58
+ { Boolean ( error ) && ! isApiValidationError ( error ) && (
59
+ < ErrorAlert error = { error } />
60
+ ) }
57
61
58
- < TextField
59
- { ...getFieldHelpers ( "name" ) }
60
- autoFocus
61
- fullWidth
62
- label = "Name"
63
- />
64
- < TextField
65
- { ...getFieldHelpers ( "display_name" , {
66
- helperText : "Optional: keep empty to default to the name." ,
67
- } ) }
68
- fullWidth
69
- label = "Display Name"
70
- />
71
- < IconField
72
- { ...getFieldHelpers ( "avatar_url" ) }
73
- onChange = { onChangeTrimmed ( form ) }
74
- fullWidth
75
- label = "Avatar URL"
76
- onPickEmoji = { ( value ) => form . setFieldValue ( "avatar_url" , value ) }
77
- />
78
- </ Stack >
79
- < FormFooter onCancel = { onCancel } isLoading = { isLoading } />
80
- </ form >
81
- </ FullPageForm >
82
- </ Margins >
62
+ < TextField
63
+ { ...getFieldHelpers ( "name" ) }
64
+ autoFocus
65
+ fullWidth
66
+ label = "Name"
67
+ />
68
+ < TextField
69
+ { ...getFieldHelpers ( "display_name" , {
70
+ helperText : "Optional: keep empty to default to the name." ,
71
+ } ) }
72
+ fullWidth
73
+ label = "Display Name"
74
+ />
75
+ < IconField
76
+ { ...getFieldHelpers ( "avatar_url" ) }
77
+ onChange = { onChangeTrimmed ( form ) }
78
+ fullWidth
79
+ label = "Avatar URL"
80
+ onPickEmoji = { ( value ) => form . setFieldValue ( "avatar_url" , value ) }
81
+ />
82
+ </ FormFields >
83
+ </ FormSection >
84
+ < FormFooter onCancel = { onCancel } isLoading = { isLoading } />
85
+ </ HorizontalForm >
83
86
) ;
84
87
} ;
85
88
export default CreateGroupPageView ;
0 commit comments