Skip to content

Commit 3d3fc06

Browse files
author
NarrowsProjects
committed
create: activeFilterIndicator
1 parent e8e4bd5 commit 3d3fc06

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

lib/public/app.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,33 @@ label {
718718
opacity: 0.5;
719719
}
720720

721+
.active-filters-indicator {
722+
border-radius: .25rem;
723+
padding: var(--space-xs) var(--space-s) var(--space-xs) var(--space-s);
724+
margin: 0 0 0 var(--space-s);
725+
}
726+
727+
.inactive {
728+
opacity: 0.5;
729+
pointer-events: none;
730+
}
731+
732+
.pulse-green {
733+
animation: pulseGreen 2s infinite;
734+
}
735+
736+
@keyframes pulseGreen {
737+
0% {
738+
box-shadow: 0 0 0px rgba(102, 255, 7, 0.6);
739+
}
740+
50% {
741+
box-shadow: 0 0 10px rgba(102, 255, 7, 0.9);
742+
}
743+
100% {
744+
box-shadow: 0 0 0px rgba(102, 255, 7, 0.6);
745+
}
746+
}
747+
721748
/**
722749
* Breakpoints :
723750
* small : x < 600 (default styles)

lib/public/components/Filters/common/filtersPanelPopover.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,23 @@ const pasteButtonOption = (model) => {
168168
}, 'Paste filters');
169169
};
170170

171+
/**
172+
* A indicates if any filters are currently active on the page
173+
*
174+
* @param {boolean} activeFilters if true, component will turn green and glow
175+
* @returns {Component} the active filters indicator
176+
*/
177+
const activeFilterIndicator = (activeFilters) => {
178+
const innerText = 'Filters ' + (activeFilters ? 'Active' : 'Inactive');
179+
console.log(innerText);
180+
181+
let element = '.active-filters-indicator.b1';
182+
183+
element += (activeFilters ? '.pulse-green.b-success.success' : '.inactive')
184+
185+
return h(element, innerText);
186+
}
187+
171188
/**
172189
* Return component composed of the filter popover button and a dropdown trigger
173190
*
@@ -180,8 +197,7 @@ const pasteButtonOption = (model) => {
180197
export const filtersPanelPopover = (filteringModel, filtersConfiguration, configuration) => {
181198
const hasActiveFilters = filteringModel.isAnyFilterActive();
182199

183-
return h(
184-
'.flex-row.items-center.btn-group',
200+
return h(`.flex-row.items-center.btn-group`,
185201
[
186202
filtersPanelButton(filteringModel, filtersConfiguration, configuration),
187203
DropdownComponent(
@@ -195,6 +211,7 @@ export const filtersPanelPopover = (filteringModel, filtersConfiguration, config
195211
],
196212
),
197213
),
214+
activeFilterIndicator(hasActiveFilters),
198215
],
199216
);
200217
};

0 commit comments

Comments
 (0)