|
|
@ -1,8 +1,9 @@
|
|
|
|
import React from 'react'
|
|
|
|
import React from 'react'
|
|
|
|
import enhanceWithClickOutside from 'react-click-outside'
|
|
|
|
import enhanceWithClickOutside from 'react-click-outside'
|
|
|
|
import { TwitterPicker } from 'react-color'
|
|
|
|
import { SketchPicker } from 'react-color'
|
|
|
|
import WindowPointer from './WindowPointer'
|
|
|
|
import WindowPointer from './WindowPointer'
|
|
|
|
import { COLORS } from '../lib/constants'
|
|
|
|
import { COLORS } from '../lib/constants'
|
|
|
|
|
|
|
|
import { parseRGBA } from '../lib/util'
|
|
|
|
|
|
|
|
|
|
|
|
class ColorPicker extends React.Component {
|
|
|
|
class ColorPicker extends React.Component {
|
|
|
|
constructor() {
|
|
|
|
constructor() {
|
|
|
@ -21,7 +22,7 @@ class ColorPicker extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handlePickColor(color) {
|
|
|
|
handlePickColor(color) {
|
|
|
|
this.props.onChange(color.hex)
|
|
|
|
this.props.onChange(parseRGBA(color.rgb))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
@ -35,11 +36,7 @@ class ColorPicker extends React.Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="colorpicker-picker" hidden={!this.state.isVisible}>
|
|
|
|
<div className="colorpicker-picker" hidden={!this.state.isVisible}>
|
|
|
|
<WindowPointer fromLeft="15px" />
|
|
|
|
<WindowPointer fromLeft="15px" />
|
|
|
|
<TwitterPicker
|
|
|
|
<SketchPicker color={this.props.bg} onChangeComplete={this.handlePickColor} />
|
|
|
|
color={this.props.bg}
|
|
|
|
|
|
|
|
onChangeComplete={this.handlePickColor}
|
|
|
|
|
|
|
|
triangle="hide"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<style jsx>{`
|
|
|
|
<style jsx>{`
|
|
|
|
.colorpicker-container {
|
|
|
|
.colorpicker-container {
|
|
|
@ -79,28 +76,31 @@ class ColorPicker extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* react-color overrides */
|
|
|
|
/* react-color overrides */
|
|
|
|
.colorpicker-picker :global(.twitter-picker) {
|
|
|
|
.colorpicker-picker :global(.sketch-picker) {
|
|
|
|
width: 278px !important;
|
|
|
|
|
|
|
|
border: 0.5px solid ${COLORS.SECONDARY} !important;
|
|
|
|
border: 0.5px solid ${COLORS.SECONDARY} !important;
|
|
|
|
border-radius: 3px !important;
|
|
|
|
border-radius: 3px !important;
|
|
|
|
background: #1a1a1a !important;
|
|
|
|
background: #1a1a1a !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.colorpicker-picker > :global(div > div:nth-child(3) > div:nth-child(11)) {
|
|
|
|
.colorpicker-picker > :global(.sketch-picker > div:nth-child(3) > div > div > span) {
|
|
|
|
background: #1a1a1a !important;
|
|
|
|
|
|
|
|
border: 0.5px solid ${COLORS.SECONDARY} !important;
|
|
|
|
|
|
|
|
border-right: none !important;
|
|
|
|
|
|
|
|
border-radius: 3px 0 0 3px !important;
|
|
|
|
|
|
|
|
color: ${COLORS.SECONDARY} !important;
|
|
|
|
color: ${COLORS.SECONDARY} !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.colorpicker-picker > :global(div > div:nth-child(3) > div:nth-child(12) > input) {
|
|
|
|
.colorpicker-picker > :global(.sketch-picker > div:nth-child(3) > div > div > input) {
|
|
|
|
background: rgba(255, 255, 255, 0.165) !important;
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
|
|
background: rgba(255, 255, 255, 0.165);
|
|
|
|
color: #fff !important;
|
|
|
|
color: #fff !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.colorpicker-picker > :global(div > div:nth-child(3) > span > div) {
|
|
|
|
.colorpicker-picker
|
|
|
|
border-radius: 2px !important;
|
|
|
|
> :global(.sketch-picker
|
|
|
|
|
|
|
|
> div:nth-child(2)
|
|
|
|
|
|
|
|
> div:nth-child(1)
|
|
|
|
|
|
|
|
> div:nth-child(2), .sketch-picker > div:nth-child(2) > div:nth-child(2)) {
|
|
|
|
|
|
|
|
background: #fff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`}</style>
|
|
|
|
`}</style>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|