This commit is contained in:
casperlamboo 2018-01-18 11:14:21 +01:00
parent 0f7da85453
commit bbd8bc529d

View File

@ -34,11 +34,16 @@ _SelectField.contextTypes = contextTypes;
_SelectField.propTypes = propTypes; _SelectField.propTypes = propTypes;
export const SelectField = muiThemeable()(_SelectField); export const SelectField = muiThemeable()(_SelectField);
const _TextField = ({ name, muiTheme, ...props }, context) => ( const _TextField = ({ name, muiTheme: { palette }, ...props }, context) => (
<TextFieldIcon <TextFieldIcon
{...props} {...props}
icon={context.advancedFields.includes(name) && <RefreshIcon style={{ fill: muiTheme.palette.textColor }} onTouchTap={() => context.onChange(name, null)} />} icon={context.advancedFields.includes(name) && <RefreshIcon
floatingLabelStyle={{ color: context.advancedFields.includes(name) ? muiTheme.palette.primary1Color : muiTheme.palette.primary3Color }} style={{ fill: palette.textColor }}
onTouchTap={() => context.onChange(name, null)}
/>}
floatingLabelStyle={{
color: context.advancedFields.includes(name) ? palette.primary1Color : palette.primary3Color
}}
disabled={context.disabled} disabled={context.disabled}
value={_.get(context, name)} value={_.get(context, name)}
onChange={(event, value) => context.onChange(name, value)} onChange={(event, value) => context.onChange(name, value)}
@ -48,12 +53,17 @@ _TextField.contextTypes = contextTypes;
_TextField.propTypes = propTypes; _TextField.propTypes = propTypes;
export const TextField = muiThemeable()(_TextField); export const TextField = muiThemeable()(_TextField);
const _NumberField = ({ name, min, max, muiTheme, ...props }, context) => ( const _NumberField = ({ name, min, max, muiTheme: { palette }, ...props }, context) => (
<TextFieldIcon <TextFieldIcon
{...props} {...props}
type="number" type="number"
icon={context.advancedFields.includes(name) && <RefreshIcon style={{ fill: muiTheme.palette.textColor }} onTouchTap={() => context.onChange(name, null)} />} icon={context.advancedFields.includes(name) && <RefreshIcon
floatingLabelStyle={{ color: context.advancedFields.includes(name) ? muiTheme.palette.primary1Color : muiTheme.palette.primary3Color }} style={{ fill: palette.textColor }}
onTouchTap={() => context.onChange(name, null)} />
}
floatingLabelStyle={{
color: context.advancedFields.includes(name) ? palette.primary1Color : palette.primary3Color
}}
disabled={context.disabled} disabled={context.disabled}
value={_.get(context, name.toString())} value={_.get(context, name.toString())}
onChange={(event, value) => { onChange={(event, value) => {
@ -68,17 +78,21 @@ _NumberField.contextTypes = contextTypes;
_NumberField.propTypes = propTypes; _NumberField.propTypes = propTypes;
export const NumberField = muiThemeable()(_NumberField); export const NumberField = muiThemeable()(_NumberField);
export const _Checkbox = ({ name, muiTheme, ...props }, context) => ( export const _Checkbox = ({ name, muiTheme: { palette }, ...props }, context) => (
<span style={{ display: 'flex', position: 'relative' }}> <span style={{ display: 'flex', position: 'relative' }}>
<MaterialUICheckbox <MaterialUICheckbox
{...props} {...props}
style={{ display: 'block' }} style={{ display: 'block' }}
iconStyle={{ fill: context.advancedFields.includes(name) ? muiTheme.palette.primary1Color : muiTheme.palette.primary3Color }} iconStyle={{
fill: context.advancedFields.includes(name) ? palette.primary1Color : palette.primary3Color
}}
disabled={context.disabled} disabled={context.disabled}
checked={_.get(context, name)} checked={_.get(context, name)}
onCheck={(event, value) => context.onChange(name, value)} onCheck={(event, value) => context.onChange(name, value)}
/> />
{context.advancedFields.includes(name) && <RefreshIcon onTouchTap={() => context.onChange(name, null)} />} {context.advancedFields.includes(name) && <RefreshIcon
onTouchTap={() => context.onChange(name, null)}
/>}
</span> </span>
); );
_Checkbox.contextTypes = contextTypes; _Checkbox.contextTypes = contextTypes;