add endAdornment to upload field

replace existing upload field
This commit is contained in:
Barry Gitarts 2019-07-22 14:46:21 -04:00 committed by Barry G
parent 55a2fe40a6
commit f5c5abbaf4
2 changed files with 25 additions and 51 deletions

View File

@ -19,6 +19,8 @@ const styles = theme => ({
root: {
gridColumnStart: 1,
gridColumnEnd: 13,
borderRadius: 8,
backgroundColor: '#edf2f5',
'label + &': {
gridRowStart: 2,
gridColumnStart: 1,
@ -78,6 +80,7 @@ function Input({
classes,
idFor,
isRequired,
endAdornment,
InputProps,
label,
bottomRightLabel,
@ -94,11 +97,14 @@ function Input({
const bottomLeft = bottomLeftLabel ? renderLabel(classnames(classes.formLabel, classes.bottomLeft), idFor, bottomLeftLabel) : null
const bottomRight = bottomRightLabel ? renderLabel(classnames(classes.formLabel, classes.bottomRight), idFor, bottomRightLabel) : null
return (
<FormControl className={classnames(classes.margin, classes.container, className)}>
<FormControl
className={classnames(classes.margin, classes.container, className)}
>
{ labelForm }
<InputBase
id={idFor}
InputProps={InputProps}
endAdornment={endAdornment}
placeholder={placeholder}
name={name}
onChange={onChange}

View File

@ -25,6 +25,10 @@ const hoursToSeconds = hours => hours * 60 * 60
const helperText = 'The length of time the Project has to veto when the project delegates to another delegate and they pledge those funds to a project'
const styles = theme => ({
adornmentText: {
cursor: 'pointer',
color: '#4360DF'
},
root: {
display: 'grid',
gridTemplateColumns: 'repeat(12, [col] 1fr)',
@ -301,62 +305,26 @@ const SubmissionSection = ({ classes, history }) => {
/>
<IconTextField
iconName="photo"
InputProps={{
startAdornment: (
endAdornment={(
<InputAdornment position="start">
<CloudUpload
style={{ cursor: 'pointer' }}
<span
className={classes.adornmentText}
onClick={() => {
const activeField = 'video'
setStatus({ ...status, activeField })
uploadInput.click()
}
}
/>
>Browse
</span>
</InputAdornment>
),
classes: {
input: classes.textInput
}
}}
)}
className={fullWidth}
isRequired={true}
idFor="video"
name="video"
placeholder="Upload video or enter url"
onChange={handleChange}
onBlur={handleBlur}
value={values.title || ''}
/>
<TextField
className={classes.textField}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<CloudUpload
style={{ cursor: 'pointer' }}
onClick={() => {
const activeField = 'video'
setStatus({ ...status, activeField })
uploadInput.click()
}
}
/>
</InputAdornment>
),
classes: {
input: classes.textInput
}
}}
id="video"
name="video"
label="Upload video or enter url"
placeholder="Upload video or enter url"
margin="normal"
variant="outlined"
onChange={handleChange}
onBlur={handleBlur}
value={values.video || ''}
/>
<FormControlLabel