[dashboard] adding an option to duplicate slices when "Saving AS" (#3391)

* [dashboard] adding an option to duplicate slices when "Saving AS"

* Fix tests
This commit is contained in:
Maxime Beauchemin
2017-08-30 14:09:29 -07:00
committed by GitHub
parent 3b4cd812ae
commit e53f3032bb
10 changed files with 135 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import ControlHeader from '../ControlHeader';
import Checkbox from '../../../components/Checkbox';
const propTypes = {
name: PropTypes.string.isRequired,
@@ -15,24 +16,22 @@ const defaultProps = {
onChange: () => {},
};
const checkboxStyle = { paddingRight: '5px' };
export default class CheckboxControl extends React.Component {
onToggle() {
this.props.onChange(!this.props.value);
onChange(checked) {
this.props.onChange(checked);
}
render() {
return (
<ControlHeader
{...this.props}
onClick={this.onToggle.bind(this)}
leftNode={
<span>
<i
className={`fa fa-check ${this.props.value ? 'text-primary' : 'text-transparent'}`}
onClick={this.onToggle.bind(this)}
style={{ border: '1px solid #aaa', borderRadius: '2px', cursor: 'pointer' }}
/>
&nbsp;&nbsp;
</span>
<Checkbox
onChange={this.onChange.bind(this)}
style={checkboxStyle}
checked={!!this.props.value}
/>
}
/>
);