Skip to content

Commit fd77140

Browse files
committed
Start work on a customized color picker
1 parent a98bd06 commit fd77140

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/component/Widget.css

+9
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,13 @@
8787

8888
.HorizontalFader {
8989

90+
}
91+
92+
.MyPicker .hue {
93+
position: relative;
94+
height: 20px;
95+
width: 200px;
96+
}
97+
.MyPicker .hue .hue-horizontal>div>div {
98+
height: 18px !important;
9099
}

src/component/Widget.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component } from 'react'
2-
import { CirclePicker, SketchPicker } from 'react-color'
2+
import { CirclePicker, CustomPicker, SketchPicker } from 'react-color'
3+
34
import './Widget.css'
45

56
export class DeviceLabel extends Component {
@@ -171,6 +172,21 @@ export class ColorCircle extends Component {
171172
)
172173
}
173174
}
175+
class MyPicker extends Component {
176+
render() {
177+
let { Alpha, Hue } = require('react-color/lib/components/common')
178+
return (
179+
<div className="MyPicker">
180+
<div className="hue">
181+
<Hue
182+
{...this.props}
183+
onChange={ this.handleChange }
184+
/>
185+
</div>
186+
</div>
187+
)
188+
}
189+
}
174190
export class ColorSketch extends Component {
175191
render () {
176192
return (
@@ -183,6 +199,16 @@ export class ColorSketch extends Component {
183199
presetColors={["#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#FFF", "#000",
184200
"#F90", "#F09", "#0F9", "#9F0", "#90F", "#09F", "#999", "#333"]}
185201
/>
202+
{/*<MyPicker
203+
name={this.props.name}
204+
color={this.props.storedValue}
205+
onChange={this.props.handleChange}
206+
rgb={this.props.color}
207+
// hsl={{h: 0, s: 0, l: 0}}
208+
disableAlpha={this.props.disableAlpha}
209+
presetColors={["#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#FFF", "#000",
210+
"#F90", "#F09", "#0F9", "#9F0", "#90F", "#09F", "#999", "#333"]}
211+
/>*/}
186212
</div>
187213
)
188214
}

0 commit comments

Comments
 (0)