Interactive interface for browsing global, full-resolution satellite imagery
refactor switch id styling, add border prop
Ed Platoae180a354adf
diff --git a/web/css/switch.css b/web/css/switch.cssindex 11121d13f..370dd1893 100644--- a/web/css/switch.css+++ b/web/css/switch.css@@ -55,3 +55,9 @@.react-switch-label:active .react-switch-button {width: 20px;}++.switch-thin-border .react-switch-label {+ border: thin solid rgb(97, 97, 97);+ height: 17px;+ width: 32px;+}diff --git a/web/css/timeline.css b/web/css/timeline.cssindex 7cd5cb539..ffe391106 100644--- a/web/css/timeline.css+++ b/web/css/timeline.css@@ -787,22 +787,18 @@ button:focus {color: #999;}-#wv-toggle-data-matching-main {+.wv-toggle-data-matching-main {align-items: center;margin: 0;white-space: nowrap;flex-grow: 1;}-#wv-toggle-data-matching-main .react-switch-case {+.wv-toggle-data-matching-main .react-switch-case {width: 45px;}-#wv-toggle-data-matching-main .react-switch-label {- border: thin solid rgb(97, 97, 97);-}--#wv-toggle-data-matching-main > div.react-switch-label-case.switch-col {+.wv-toggle-data-matching-main > div.react-switch-label-case.switch-col {padding-left: 5px;}diff --git a/web/js/components/timeline/timeline-data/timeline-data.js b/web/js/components/timeline/timeline-data/timeline-data.jsindex 2a18dab5c..273797aff 100644--- a/web/js/components/timeline/timeline-data/timeline-data.js+++ b/web/js/components/timeline/timeline-data/timeline-data.js@@ -324,9 +324,10 @@ class TimelineData extends Component {<h3 className="timeline-data-panel-header-title">LAYER COVERAGE</h3><Switchactive={shouldIncludeHiddenLayers}+ bordercolor="00457b"id="wv-toggle-data-matching-toggle"- containerId="wv-toggle-data-matching-main"+ containerClassAddition="wv-toggle-data-matching-main"label="Include Hidden Layers"toggle={() => this.addMatchingCoverageToTimeline(!shouldIncludeHiddenLayers)}/>diff --git a/web/js/components/util/switch.js b/web/js/components/util/switch.jsindex 913760832..e2931f1f3 100644--- a/web/js/components/util/switch.js+++ b/web/js/components/util/switch.js@@ -8,9 +8,10 @@ import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';// https://upmostly.com/tutorials/build-a-react-switch-toggle-componentconst Switch = (props) => {const {+ border,id,color,- containerId,+ containerClassAddition,active,toggle,label,@@ -20,13 +21,14 @@ const Switch = (props) => {const [tooltipOpen, toggleTooltip] = useState(false);const activeColor = color || '007BFF';const style = isActive ? { backgroundColor: `#${activeColor}` } : {};+ const containerClass = `react-switch ${containerClassAddition || ''} ${border ? 'switch-thin-border' : ''}`;useEffect(() => {toggleActive(active);}, [active]);return (- <div id={containerId} className="react-switch">+ <div className={containerClass}><div className="react-switch-case switch-col"><inputclassName="react-switch-checkbox"@@ -68,12 +70,14 @@ const Switch = (props) => {);};Switch.defaultProps = {- containerId: '',+ containerClassAddition: '',+ border: false,};Switch.propTypes = {active: PropTypes.bool,+ border: PropTypes.bool,color: PropTypes.string,- containerId: PropTypes.string,+ containerClassAddition: PropTypes.string,id: PropTypes.string,label: PropTypes.string,toggle: PropTypes.func,