Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow hiding of all filters in a category #1371

Merged
merged 2 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/controls/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ class FilterData extends React.Component {
return {
filterName,
displayName: filterBadgeDisplayName(n, this.getFilterTitle(filterName)),
remove: () => {this.props.dispatch(applyFilter("set", filterName, []));}
anyFiltersActive: () => this.props.activeFilters[filterName].filter((f) => f.active).length>0,
remove: () => {this.props.dispatch(applyFilter("set", filterName, []));},
activate: () => {this.props.dispatch(applyFilter("add", filterName, this.props.activeFilters[filterName].map((f) => f.value)));},
inactivate: () => {this.props.dispatch(applyFilter("inactivate", filterName, this.props.activeFilters[filterName].map((f) => f.value)));}
};
});
}
Expand Down Expand Up @@ -138,9 +141,12 @@ class FilterData extends React.Component {
{inUseFilters.map((filter) => (
<div style={{display: 'inline-block', margin: '2px'}} key={filter.displayName}>
<FilterBadge
active
active={filter.anyFiltersActive()}
canMakeInactive
id={filter.displayName}
remove={filter.remove}
activate={filter.activate}
inactivate={filter.inactivate}
onHoverMessage={`Data is currently filtered by ${filter.displayName}`}
>
{filter.displayName}
Expand Down
2 changes: 1 addition & 1 deletion src/components/info/filterBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const SelectedFilterTextContainer = styled(BaseContainer)`

const BadgeContainer = styled.div`
background-color: #E9F2F6;
${(props) => props.striped ? 'background: repeating-linear-gradient(135deg, #E9F2F6, #E9F2F6 5px, transparent 5px, transparent 10px);' : ''};
${(props) => props.striped ? 'background: repeating-linear-gradient(135deg, #E9F2F6, #E9F2F6 5px, #FFFFFF 5px, #FFFFFF 10px);' : ''};
display: inline-block;
font-size: 14px;
border-radius: 2px;
Expand Down