import * as React from 'react'; import { ValidationState, Validation } from '../../models/Validation'; import { Colors } from '../../models/colors'; import { TextBoxProps } from '../../containers/text-box/TextBox'; import { CheckboxProps } from '../../containers/checkbox/Checkbox'; import CheckboxOne from '../../components/checkboxes/checkbox-one/CheckboxOne'; import TextBoxOne from '../../components/text-boxes/text-box-one/TextBoxOne'; interface ApplyInTenMinProps { name: string; palette?: Colors; confirmed?: boolean; loanType: string; automationName?: string; required?: boolean; validationState?: Validation; value?: boolean; textBox?: React.ReactElement; checkbox?: React.ReactElement; onChange?: (name: string, value: boolean) => void; notifyValidity?: (name: string, state: ValidationState, errorMessage?: string) => void; getConfig?: (name: string | string[]) => { [key: string]: any }; translator?: Function; checkIfTranslateExist?: Function; } export default class ApplyInTenMin extends React.PureComponent { render() { let valid; if (this.props.validationState) { valid = this.props.validationState.state; } const checkbox = React.cloneElement(this.props.checkbox || , { automationName: this.props.automationName || this.props.name, palette: this.props.palette, id: 'checkbox-apply-in-ten-min', label: this.props.translator(`${this.props.name}.checkboxLabel`), checked: this.props.value, onChange: this.props.onChange, name: this.props.name, required: this.props.required, notifyValidity: this.props.notifyValidity, valid, translator: this.props.translator }); const { eligibleLink, privacyLink } = this.props.getConfig(['eligibleLink', 'privacyLink']); const content = [

{this.props.translator(`${this.props.name}.title`)}

{this.props.translator(`${this.props.name}.text1`, { loanType: this.props.loanType })}

{this.props.translator(`${this.props.name}.text2`)} {this.props.translator(`${this.props.name}.link1`)} {this.props.translator(`${this.props.name}.text3`)}

{this.props.translator(`${this.props.name}.text4`)} {this.props.translator(`${this.props.name}.link2`)} {this.props.translator(`${this.props.name}.text5`)}

{checkbox}
]; return React.cloneElement( this.props.textBox || , { palette: this.props.palette }, content ); } }