import * as _ from "lodash"; import * as React from "react"; import { Button, ButtonSize, ButtonType, IButtonProps } from "../Button"; import { Input, IInputProps } from "../Input"; import { Select, ISelectProps } from "../Select"; import { IRevealProps, Reveal, RevealType } from "../Reveal"; export interface IFormProps { inputs?: IInputProps[]; selects?: ISelectProps[]; submit: Partial; onSubmit?: (data: object) => void; onCancel?: () => void; className?: string; reveal?: Partial; } interface IFormState { data: object; } const defaultFormState: IFormState = { data: {}, }; export class Form extends React.PureComponent { public state: IFormState = defaultFormState; public render() { return (
{ e.preventDefault(); this.props.onSubmit(this.state.data); }}> {this.props.inputs && this.props.inputs.map((input, index) => (
))} {this.props.selects && this.props.selects.map((select: ISelectProps, index) => (