Skip to content

Commit

Permalink
allow brand spaces (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianovide committed Jul 31, 2019
1 parent ac56850 commit 7868e90
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
46 changes: 21 additions & 25 deletions src/components/PhotoPage/TitleTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import React, { Component } from 'react';
import { withStyles } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';

import _ from 'lodash';

import enums from '../../types/enums';

const styles = theme => ({
Expand All @@ -16,10 +14,8 @@ const styles = theme => ({
});
class TitleTextField extends Component {

dataFormater = value => {
value = (value.trim && value.trim()) || value;
const valueTyped = this.props.field.type === enums.TYPES.number ? Number(value) : String(value);
return _.isEmpty(value) ? value : valueTyped;
dataFormater = value =>{
return this.props.field.type === enums.TYPES.number ? Number(value) : String(value);
}

onChangeHandler = (e) => {
Expand All @@ -33,25 +29,25 @@ class TitleTextField extends Component {
// TODO: proptypes
const { field, fieldValue, classes } = this.props;
return (
<TextField
InputLabelProps= {{
shrink: true,
style: { color: '#000' },
}}
label={field.title}
fullWidth
id={'textfield' + field.title}
type={field.type}
required={true}
placeholder={field.placeholder}
className='text-field'
value={fieldValue.value}
onChange={this.onChangeHandler}
error= {fieldValue.error}
InputProps={Object.assign({
className: classes.cssUnderline
}, field.inputProps)}
/>
<TextField
InputLabelProps= {{
shrink: true,
style: { color: '#000' },
}}
label={field.title}
fullWidth
id={'textfield' + field.title}
type={field.type}
required={true}
placeholder={field.placeholder}
className='text-field'
value={fieldValue.value}
onChange={this.onChangeHandler}
error= {fieldValue.error}
InputProps={Object.assign({
className: classes.cssUnderline
}, field.inputProps)}
/>
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/custom/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default { ...STATIC_CONFIG,
title: 'Brand',
type: enums.TYPES.string,
placeholder: 'eg. whatever',
regexValidation: '^([ ]*\\w+[ ]*)+$'
regexValidation: '.+'
},
}
},
Expand Down

0 comments on commit 7868e90

Please sign in to comment.