import React from 'react'; import { css } from '@emotion/core'; import { Box, Flex, Text } from '@rebass/emotion'; import slugifyURL from 'slugify'; import { FluidContainer } from 'utils/styles/mixins'; import { EmailStatus, FormModuleProps } from '../../form-module.types'; import { FormLayoutProps } from '../form-layout.types'; import { ErrorText, FormWrapper, FullFormFieldStyles, IconStyle, SendingSymbol, SubmitWrapper } from './begonia-centered.styles'; import { getColumnSize } from 'utils/styles/grid'; import { FormField } from 'types/forms'; import TextInput from '../../../../../fields/text-input'; import TextArea from '../../../../../fields/text-area'; import Icon from 'components/icon'; import { ICON_NAMES } from 'utils/constants/assets'; const BegoniaCentered = (props: FormModuleProps & FormLayoutProps): JSX.Element => { const newFields: FormField[] = props.data.contactFormFields.map(field => { return { id: slugifyURL(field.label), label: field.label, width: field.width, required: field.required, config: { inputType: field.fieldType } }; }); return (
{props.data.title} {props.data.bodyCopy} { newFields.map((field): JSX.Element | null => { const RenderingField = field.config!.inputType === "textarea" ? TextArea : TextInput; return ( ); }) } { props.error && Something went wrong, please try again. } { props.status === EmailStatus.NONE ? 'Send' : props.status === EmailStatus.SENDING ? : props.status === EmailStatus.SENT ? : }
); }; export default BegoniaCentered;