import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
// import { is, fromJS } from 'immutable'
|
import { SketchPicker } from 'react-color'
|
import {Popover } from 'antd'
|
|
import './index.scss'
|
|
class ColorSketch extends Component {
|
static propTpyes = {
|
card: PropTypes.object,
|
onDoubleClick: PropTypes.func
|
}
|
state = {
|
visible: false,
|
color: '#f8e71c',
|
};
|
|
handleClick = () => {
|
this.setState({ visible: !this.state.visible })
|
};
|
|
handleClose = () => {
|
this.setState({ visible: false })
|
};
|
|
handleChange = (color) => {
|
this.setState({ color: color.rgb })
|
};
|
|
render() {
|
const { color } = this.state
|
return (
|
<Popover content={
|
<SketchPicker color={ this.state.color } onChange={ this.handleChange } />
|
} overlayClassName="color-sketch-popover" placement="bottomRight" title="" trigger="click">
|
<div className="color-sketch-block" onClick={ this.handleClick }>
|
<div className="color-sketch-block-inner" style={ {background: `rgba(${ color.r }, ${ color.g }, ${ color.b }, ${ color.a })`} }></div>
|
</div>
|
</Popover>
|
)
|
}
|
}
|
|
export default ColorSketch
|