mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
Better looking checkboxes (#3345)
Also showing icon only on hover on control headers
This commit is contained in:
committed by
GitHub
parent
e79adbbc5f
commit
254645773c
@@ -56,6 +56,7 @@ const defaultProps = {
|
||||
export default class Control extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hovered: false };
|
||||
this.validate = this.validate.bind(this);
|
||||
this.onChange = this.onChange.bind(this);
|
||||
}
|
||||
@@ -65,6 +66,9 @@ export default class Control extends React.PureComponent {
|
||||
onChange(value, errors) {
|
||||
this.validateAndSetValue(value, errors);
|
||||
}
|
||||
setHover(hovered) {
|
||||
this.setState({ hovered });
|
||||
}
|
||||
validateAndSetValue(value, errors) {
|
||||
let validationErrors = this.props.validationErrors;
|
||||
let currentErrors = this.validate(value);
|
||||
@@ -96,9 +100,14 @@ export default class Control extends React.PureComponent {
|
||||
const ControlType = controlMap[this.props.type];
|
||||
const divStyle = this.props.hidden ? { display: 'none' } : null;
|
||||
return (
|
||||
<div style={divStyle}>
|
||||
<div
|
||||
style={divStyle}
|
||||
onMouseEnter={this.setHover.bind(this, true)}
|
||||
onMouseLeave={this.setHover.bind(this, false)}
|
||||
>
|
||||
<ControlType
|
||||
onChange={this.onChange}
|
||||
hovered={this.state.hovered}
|
||||
{...this.props}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user