You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.8 KiB
48 lines
1.8 KiB
import React, { FC, FocusEventHandler } from 'react'
|
|
import { useDispatch } from 'react-redux'
|
|
import { Link } from 'react-router-dom'
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
import { faUpload, faIdCard } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { checkGroupAvailability } from 'src/actions/registration'
|
|
|
|
import CheckboxField from 'src/components/forms/checkbox-field'
|
|
import TextField from 'src/components/forms/text-field'
|
|
import SelectField from 'src/components/forms/select-field'
|
|
import FileField from 'src/components/forms/file-field'
|
|
|
|
const CreateGroupForm: FC = () => {
|
|
const dispatch = useDispatch()
|
|
|
|
const checkAvailability = (value: string) => {
|
|
if (value.length > 3) {
|
|
dispatch(checkGroupAvailability(value))
|
|
}
|
|
}
|
|
|
|
const registrationOptions = {
|
|
open: 'Anyone can join',
|
|
approval: 'Users must be approved',
|
|
closed: 'Registration closed',
|
|
}
|
|
|
|
return (
|
|
<div className="container">
|
|
<TextField name="group-name" label="Community Name" onBlur={e => checkAvailability(e.target.value)} />
|
|
<br />
|
|
<SelectField name="group-registration" label="Registration" options={registrationOptions} icon={faIdCard} />
|
|
<br />
|
|
<FileField name="group-image" label="Community Image" help="Approx 128 x 128. Max 5 MBs." />
|
|
<br />
|
|
<FileField name="group-cover-image" label="Cover Image" help="Approx 400 x 200. Max 5 MBs." />
|
|
<br />
|
|
<FileField name="group-icon-image" label="Icon Image" help="Approx 32 x 32. Max 5 MBs." />
|
|
<br />
|
|
<CheckboxField name="group-agree">
|
|
I agree to the Communities <Link to="/terms/communities">terms and conditions</Link>.
|
|
</CheckboxField>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default CreateGroupForm
|