Interactive interface for browsing global, full-resolution satellite imagery
Workaround for BooleanFacet checkbox issue
Jason Kent5b6dbf767968
diff --git a/web/js/components/layer/product-picker/search/boolean-facet.js b/web/js/components/layer/product-picker/search/boolean-facet.jsnew file mode 100644index 000000000..c779f707a--- /dev/null+++ b/web/js/components/layer/product-picker/search/boolean-facet.js@@ -0,0 +1,58 @@+import PropTypes from 'prop-types';+import React from 'react';+++function BooleanFacet({+ className,+ label,+ options,+ onChange,+ onRemove,+ values,+}) {+ const trueOptions = options.find((option) => option.value === 'true');+ if (!trueOptions) return null;+ const isSelected = values.includes('true');++ const apply = () => onChange('true');+ const remove = () => onRemove('true');+ const toggle = () => {+ // eslint-disable-next-line no-unused-expressions+ isSelected ? remove() : apply();+ };++ return (+ <fieldset className="sui-facet">+ <legend className="sui-facet__title">{label}</legend>+ <div className="sui-boolean-facet">+ <div className="sui-boolean-facet__option-input-wrapper">+ <label className="sui-boolean-facet__option-label">+ <div className="sui-boolean-facet__option-input-wrapper">+ <input+ className="sui-boolean-facet__checkbox"+ type="checkbox"+ checked={isSelected}+ onChange={toggle}+ />+ <span className="sui-boolean-facet__input-text">{label}</span>+ </div>+ <span className="sui-boolean-facet__option-count">+ {trueOptions.count}+ </span>+ </label>+ </div>+ </div>+ </fieldset>+ );+}++BooleanFacet.propTypes = {+ className: PropTypes.string,+ label: PropTypes.string.isRequired,+ onRemove: PropTypes.func.isRequired,+ options: PropTypes.array,+ values: PropTypes.array,+ onChange: PropTypes.func.isRequired,+};++export default BooleanFacet;diff --git a/web/js/modules/product-picker/facetConfig.js b/web/js/modules/product-picker/facetConfig.jsindex db3b4b0a9..8420161b3 100644--- a/web/js/modules/product-picker/facetConfig.js+++ b/web/js/modules/product-picker/facetConfig.js@@ -1,6 +1,8 @@-import {- BooleanFacet,-} from '@elastic/react-search-ui-views';+import BooleanFacet from '../../components/layer/product-picker/search/boolean-facet';++// import {+// BooleanFacet,+// } from '@elastic/react-search-ui-views';export default [{@@ -59,7 +61,7 @@ export default [field: 'processingLevelId',label: 'Processing Level',filterType: 'any',- tooltip: 'Level of data processing. For more information see: <a href="https://go.nasa.gov/3dq5oXx">https://go.nasa.gov/3dq5oXx</a>',+ tooltip: 'Level of data processing. For more information see: <a href="https://go.nasa.gov/3dq5oXx" target="_blank"> https://go.nasa.gov/3dq5oXx </a>',show: 15,hideZeroCount: true,},