[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.
 
 

52 lines
1.2 KiB

import React, { FC, useEffect } from 'react'
import { RouteComponentProps } from 'react-router'
import PageHeader from 'src/components/page-header'
import CreateGroupStep from 'src/components/create-group-step'
import CreateUserStep from 'src/components/create-user-step'
import { setTitle } from 'src/utils'
import { Form } from 'src/types'
export interface Props extends RouteComponentProps {
stepIndex: number
form: Form
initForm: () => void
register: (form: Form) => void
}
const Register: FC<Props> = ({ stepIndex, form, initForm, register }) => {
const title = () => {
switch (stepIndex) {
case 0: return 'Create Your Account'
default: return 'Create a Community'
}
}
const component = () => {
switch (stepIndex) {
case 0: return <CreateUserStep />
default: return <CreateGroupStep register={() => register(form)} />
}
}
useEffect(() => {
initForm()
}, [])
useEffect(() => {
setTitle(title())
}, [stepIndex])
return (
<div>
<PageHeader title={title()} />
<div className="main-content">
{component()}
</div>
</div>
)
}
export default Register