ensure lowercase on mobile search input

This commit is contained in:
Barry Gitarts 2018-08-11 20:13:05 -04:00
parent 586f594554
commit bd9d7b96df
1 changed files with 10 additions and 4 deletions

View File

@ -207,7 +207,7 @@ const DisplayAddress = connect(mapStateToProps)((props) => (
</Fragment> </Fragment>
)) ))
const LookupForm = ({ handleSubmit, values, handleChange, justSearch }) => ( const LookupForm = ({ handleSubmit, values, handleChange, justSearch, setFieldValue }) => (
<Fragment> <Fragment>
<form onSubmit={handleSubmit} onBlur={handleSubmit} > <form onSubmit={handleSubmit} onBlur={handleSubmit} >
<Hidden mdDown> <Hidden mdDown>
@ -226,7 +226,7 @@ const LookupForm = ({ handleSubmit, values, handleChange, justSearch }) => (
name="domainName" name="domainName"
placeholder='Search for vacant name' placeholder='Search for vacant name'
value={values.domainName} value={values.domainName}
onChange={handleChange} onChange={ev => onDomainNameChange(ev, setFieldValue)}
required required
wide /> wide />
{!justSearch && <Typography variant="subheading" style={{ color: '#939ba1', textAlign: 'center', marginTop: '25vh' }}> {!justSearch && <Typography variant="subheading" style={{ color: '#939ba1', textAlign: 'center', marginTop: '25vh' }}>
@ -252,7 +252,8 @@ const InnerForm = ({
handleSubmit, handleSubmit,
isSubmitting, isSubmitting,
status, status,
setStatus setStatus,
setFieldValue
}) => ( }) => (
<div> <div>
<Hidden mdDown> <Hidden mdDown>
@ -262,7 +263,7 @@ const InnerForm = ({
</span> </span>
</Hidden> </Hidden>
{!status {!status
? <LookupForm {...{ handleSubmit, values, handleChange }} /> ? <LookupForm {...{ handleSubmit, values, handleChange, setFieldValue }} />
: validAddress(status.address) ? : validAddress(status.address) ?
<DisplayAddress <DisplayAddress
domainName={values.domainName} domainName={values.domainName}
@ -281,6 +282,11 @@ const InnerForm = ({
</div> </div>
) )
const onDomainNameChange = (e, setFieldValue) => {
const domain = e.target.value.toLowerCase();
setFieldValue('domainName', domain, false)
}
const NameLookup = withFormik({ const NameLookup = withFormik({
mapPropsToValues: props => ({ domainName: '' }), mapPropsToValues: props => ({ domainName: '' }),
async handleSubmit(values, { status, setSubmitting, setStatus }) { async handleSubmit(values, { status, setSubmitting, setStatus }) {