Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add circle/gray checkbox customizations

Benjamin King9d2eb58a8d02
diff --git a/web/css/checkbox.css b/web/css/checkbox.css
index 2be4ed708..14305a877 100644
--- a/web/css/checkbox.css
+++ b/web/css/checkbox.css
@@ -5,8 +5,8 @@
position: absolute;
opacity: 0;
cursor: pointer;
- height: 20px;
- width: 20px;
+ height: 24px;
+ width: 24px;
left: 0;
}
.wv-checkbox::before {
@@ -20,8 +20,17 @@
line-height: 20px;
margin-right: 5px;
}
+.wv-checkbox.gray::before {
+ border: 2px solid #808080;
+}
.wv-checkbox.checked::before {
color: #fff;
content: '\2713';
background-color: #d54f21;
}
+.wv-checkbox.gray.checked::before {
+ background-color:#808080;
+}
+.wv-checkbox.wv-checkbox-round::before {
+ border-radius: 50%;
+}
diff --git a/web/js/components/util/checkbox.js b/web/js/components/util/checkbox.js
index 9943dda0c..0a5efce0c 100644
--- a/web/js/components/util/checkbox.js
+++ b/web/js/components/util/checkbox.js
@@ -36,28 +36,35 @@ export class Checkbox extends React.Component {
if (onCheck) onCheck(boo);
}
render() {
+ const { checked } = this.state;
+ const { isRound, color, classNames, id, name, title, label } = this.props;
+ const roundClassName = isRound ? 'wv-checkbox-round ' : '';
+ const defaultClassName = 'wv-checkbox ';
+ const checkedClassName = checked ? 'checked ' : '';
+ const caseClassName =
+ defaultClassName + roundClassName + checkedClassName + color;
+
return (
- <div
- className={this.state.checked ? 'wv-checkbox checked' : 'wv-checkbox'}
- onClick={this.onClick.bind(this)}
- >
+ <div className={caseClassName} onClick={this.onClick.bind(this)}>
<input
type="checkbox"
- id={this.props.id}
- title={this.props.title}
- name={this.props.name}
- checked={this.state.checked}
- className={this.props.classNames}
+ id={id}
+ title={title}
+ name={name}
+ checked={checked}
+ className={classNames}
onChange={this.handleChange.bind(this)}
/>
- <label htmlFor={this.props.id}>{this.props.label}</label>
+ <label htmlFor={id}>{label}</label>
</div>
);
}
}
Checkbox.defaultProps = {
checked: true,
- onCheck: null
+ onCheck: null,
+ isRound: false,
+ color: ''
};
Checkbox.propTypes = {
@@ -68,5 +75,7 @@ Checkbox.propTypes = {
title: PropTypes.string,
name: PropTypes.string,
label: PropTypes.string,
- onClick: PropTypes.func
+ onClick: PropTypes.func,
+ isRound: PropTypes.bool,
+ color: PropTypes.string
};