Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

overlapping icons, feedback for invalid form

Jason Kent8e41838c4cde
diff --git a/web/css/button.css b/web/css/button.css
index eefb80b14..f060a7f0a 100644
--- a/web/css/button.css
+++ b/web/css/button.css
@@ -46,3 +46,12 @@
color: #eee;
cursor: not-allowed;
}
+
+
+/*
+* Bootstrap/Reactstrap Button Overrides
+*/
+
+.btn.disabled, .btn:disabled {
+ cursor: not-allowed;
+}
\ No newline at end of file
diff --git a/web/css/events.css b/web/css/events.css
index f801cdc7b..07ca189d7 100644
--- a/web/css/events.css
+++ b/web/css/events.css
@@ -16,47 +16,6 @@
margin: 15px auto;
}
min-height: 166px;
- .dropdown {
- border: 1px solid rgba(250, 250, 250, 0.5);
- border-left: none;
- border-top: none;
- border-right: none;
- .dropdown-toggle {
- background-color: #333;
- border: none;
- width: 100%;
- font-size: 14px;
- border-radius: 0;
- padding: 4px;
- &:hover {
- background-color: #555;
- color: #fff;
- }
- &:focus {
- box-shadow: none;
- }
- }
- .dropdown-menu {
- background-color: #3a3a3a;
- color: #eee;
- border-radius: 0;
- box-shadow: 1px 1px 20px rgba(255, 255, 255, 0.15);
- width: 284px;
- }
- .dropdown-item {
- color: #eee;
- font-size: 14px;
- padding: 6px 12px;
- &:hover {
- color: #333;
- }
- &:active, &.active {
- background: #d54e21;
- color: #fff;
- text-shadow: 1px 1px 0 #000;
- }
- }
- }
}
.map-item-list li.item {
@@ -412,7 +371,8 @@
border-top: 1px solid #666;
& .filter-dates-icons {
display: inline-block;
- max-width: 227px;
+ max-width: 224px;
+ width: 224px;
}
& .filter-dates {
color: #fff;
@@ -422,9 +382,11 @@
font-size: 14px;
}
& .filter-icons {
- text-align: center;
- max-width: 225px;
- overflow: hidden;
+ margin-left: 6px;
+ justify-content: center;
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(10px, max-content)) ;
+ max-width: 205px;
max-height: 32px;
}
& .filter-button {
diff --git a/web/js/components/sidebar/event-icon.js b/web/js/components/sidebar/event-icon.js
index 1b6b6ed4f..8819d928a 100644
--- a/web/js/components/sidebar/event-icon.js
+++ b/web/js/components/sidebar/event-icon.js
@@ -21,6 +21,7 @@ export default function EventIcon ({ id, category, title }) {
}
EventIcon.propTypes = {
+ id: PropTypes.string,
category: PropTypes.string,
title: PropTypes.string,
};
diff --git a/web/js/components/sidebar/events-filter.js b/web/js/components/sidebar/events-filter.js
index 4929e35ce..a87e866bf 100644
--- a/web/js/components/sidebar/events-filter.js
+++ b/web/js/components/sidebar/events-filter.js
@@ -20,11 +20,10 @@ function EventsFilter (props) {
const [dateRange, setDateRange] = useState([selectedStartDate, selectedEndDate]);
const [allNone, setAllNone] = useState(!!selectedCategories.length);
-
-
const [categories, setCategories] = useState(selectedCategories);
+
const toggleCategory = (categoryTitle) => {
- const isActive = selectedCategories.includes(categoryTitle);
+ const isActive = categories.includes(categoryTitle);
let newCategories;
if (isActive) {
newCategories = categories.filter((category) => category !== categoryTitle);
@@ -49,6 +48,17 @@ function EventsFilter (props) {
};
const [startDate, endDate] = dateRange || [];
+ const disableApply = !startDate || !endDate || !categories.length;
+ const getDisableApplyMsg = () => {
+ let msg = '';
+ if (!startDate || !endDate) {
+ msg += 'Date range must be set.';
+ }
+ if (!categories.length) {
+ msg += ' At least one category must be selected';
+ }
+ return msg;
+ };
return (
<div className="events-filter">
@@ -56,6 +66,8 @@ function EventsFilter (props) {
<DateRangePicker
onChange={setDateRange}
value={dateRange}
+ minDate={new Date('01-01-1975')}
+ maxDate={new Date()}
required
/>
@@ -84,7 +96,13 @@ function EventsFilter (props) {
</div>
<ModalFooter>
- <Button color="primary" onClick={applyFilter} disabled={!startDate || !endDate}>
+ <Button
+ id="filter-apply-btn"
+ color="primary"
+ onClick={applyFilter}
+ disabled={disableApply}
+ title={getDisableApplyMsg()}
+ >
Apply
</Button>
<Button color="secondary" onClick={closeModal}>
diff --git a/web/js/containers/sidebar/events.js b/web/js/containers/sidebar/events.js
index 5ffc70ea1..7711ff4ed 100644
--- a/web/js/containers/sidebar/events.js
+++ b/web/js/containers/sidebar/events.js
@@ -62,6 +62,17 @@ function Events(props) {
<div className="event-container">
<div className="filter-controls">
+ <div className="filter-dates-icons">
+ <div className="filter-dates">
+ {`${selectedStartDate} - ${selectedEndDate}`}
+ </div>
+
+ <div className="filter-icons">
+ {selectedCategories.map((category) => (
+ <EventIcon id="filter-" category={category} title={category} />
+ ))}
+ </div>
+ </div>
<Button
id="event-filter-button"
className="filter-button"
@@ -74,18 +85,6 @@ function Events(props) {
>
<FontAwesomeIcon icon="filter" />
</Button>
-
- <div className="filter-dates-icons">
- <div className="filter-dates">
- {`${selectedStartDate} - ${selectedEndDate}`}
- </div>
-
- <div className="filter-icons">
- {selectedCategories.map((category) => (
- <EventIcon id="filter-" category={category} title={category} />
- ))}
- </div>
- </div>
</div>
<Scrollbars