Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import TextField from '@material-ui/core/TextField';
import * as ReactColor from 'react-color';
import get from 'lodash.get';
import pure from 'recompose/pure';
import InputAdornment from '@material-ui/core/InputAdornment';

require('./ColorInput.css');

Expand Down Expand Up @@ -88,6 +89,17 @@ class ColorInputComponent extends React.Component {
error={!!(touched && error)}
helperText={touched && error || helperText}
className={className}
InputProps={{
startAdornment: <InputAdornment position="start">
<div style={{
width: '20px',
height: '20px',
background: input.value,
marginRight: '5px',
}}
/>
</InputAdornment>,
}}
/>
{
this.state.show?
Expand Down Expand Up @@ -133,4 +145,4 @@ ColorInputComponent.defaultProps = {
};

export const ColorField = PureTextField;
export const ColorInput = addField(ColorInputComponent);
export const ColorInput = addField(ColorInputComponent);