[ABANDONED] React/Redux front end for the Flexor social network.
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.9 KiB

import React, { FC } from 'react'
import { useDispatch } from 'react-redux'
import { Link } from 'react-router-dom'
import { faIdCard } from '@fortawesome/free-solid-svg-icons'
import { checkGroupAvailability } from '../actions/registration'
import { useTheme } from '../hooks'
import CheckboxField from '../components/controls/checkbox-field'
import TextField from '../components/controls/text-field'
import SelectField from '../components/controls/select-field'
import ImageField from '../components/controls/image-field'
import CoverImageField from '../components/controls/cover-image-field'
import IconImageField from '../components/controls/icon-image-field'
import ThemeField from '../components/controls/theme-field'
const CreateGroupForm: FC = () => {
const theme = useTheme()
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>
<TextField name="group-name" label="Community Name" onBlur={e => checkAvailability(e.target.value)} />
<SelectField name="group-registration" label="Registration" options={registrationOptions} icon={faIdCard} />
<ThemeField name="group-theme" label="Color" />
<ImageField name="group-image" label="Community Image" />
<CoverImageField name="group-cover-image" />
<IconImageField name="group-icon-image" />
<CheckboxField name="group-agree">
I agree to the Communities <Link style={{ color: theme.secondary }} to="/terms/communities">terms and conditions</Link>.
</CheckboxField>
</div>
)
}
export default CreateGroupForm