|
@@ -19,7 +19,7 @@ export class ColorPickerPopover extends React.Component<IProps, any> {
|
|
|
this.state = {
|
|
this.state = {
|
|
|
tab: 'palette',
|
|
tab: 'palette',
|
|
|
color: this.props.color || DEFAULT_COLOR,
|
|
color: this.props.color || DEFAULT_COLOR,
|
|
|
- colorString: this.props.color || DEFAULT_COLOR,
|
|
|
|
|
|
|
+ colorString: this.props.color || DEFAULT_COLOR
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -32,7 +32,7 @@ export class ColorPickerPopover extends React.Component<IProps, any> {
|
|
|
if (newColor.isValid()) {
|
|
if (newColor.isValid()) {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
color: newColor.toString(),
|
|
color: newColor.toString(),
|
|
|
- colorString: newColor.toString(),
|
|
|
|
|
|
|
+ colorString: newColor.toString()
|
|
|
});
|
|
});
|
|
|
this.props.onColorSelect(color);
|
|
this.props.onColorSelect(color);
|
|
|
}
|
|
}
|
|
@@ -50,7 +50,7 @@ export class ColorPickerPopover extends React.Component<IProps, any> {
|
|
|
onColorStringChange(e) {
|
|
onColorStringChange(e) {
|
|
|
let colorString = e.target.value;
|
|
let colorString = e.target.value;
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- colorString: colorString,
|
|
|
|
|
|
|
+ colorString: colorString
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
let newColor = tinycolor(colorString);
|
|
let newColor = tinycolor(colorString);
|
|
@@ -71,11 +71,11 @@ export class ColorPickerPopover extends React.Component<IProps, any> {
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
|
this.pickerNavElem.find('li:first').addClass('active');
|
|
this.pickerNavElem.find('li:first').addClass('active');
|
|
|
- this.pickerNavElem.on('show', e => {
|
|
|
|
|
|
|
+ this.pickerNavElem.on('show', (e) => {
|
|
|
// use href attr (#name => name)
|
|
// use href attr (#name => name)
|
|
|
let tab = e.target.hash.slice(1);
|
|
let tab = e.target.hash.slice(1);
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- tab: tab,
|
|
|
|
|
|
|
+ tab: tab
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -97,24 +97,19 @@ export class ColorPickerPopover extends React.Component<IProps, any> {
|
|
|
<div className="gf-color-picker">
|
|
<div className="gf-color-picker">
|
|
|
<ul className="nav nav-tabs" id="colorpickernav" ref={this.setPickerNavElem.bind(this)}>
|
|
<ul className="nav nav-tabs" id="colorpickernav" ref={this.setPickerNavElem.bind(this)}>
|
|
|
<li className="gf-tabs-item-colorpicker">
|
|
<li className="gf-tabs-item-colorpicker">
|
|
|
- <a href="#palette" data-toggle="tab">
|
|
|
|
|
- Colors
|
|
|
|
|
- </a>
|
|
|
|
|
|
|
+ <a href="#palette" data-toggle="tab">Colors</a>
|
|
|
</li>
|
|
</li>
|
|
|
<li className="gf-tabs-item-colorpicker">
|
|
<li className="gf-tabs-item-colorpicker">
|
|
|
- <a href="#spectrum" data-toggle="tab">
|
|
|
|
|
- Custom
|
|
|
|
|
- </a>
|
|
|
|
|
|
|
+ <a href="#spectrum" data-toggle="tab">Custom</a>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
- <div className="gf-color-picker__body">{currentTab}</div>
|
|
|
|
|
|
|
+ <div className="gf-color-picker__body">
|
|
|
|
|
+ {currentTab}
|
|
|
|
|
+ </div>
|
|
|
<div>
|
|
<div>
|
|
|
- <input
|
|
|
|
|
- className="gf-form-input gf-form-input--small"
|
|
|
|
|
- value={this.state.colorString}
|
|
|
|
|
- onChange={this.onColorStringChange.bind(this)}
|
|
|
|
|
- onBlur={this.onColorStringBlur.bind(this)}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <input className="gf-form-input gf-form-input--small" value={this.state.colorString}
|
|
|
|
|
+ onChange={this.onColorStringChange.bind(this)} onBlur={this.onColorStringBlur.bind(this)}>
|
|
|
|
|
+ </input>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|