Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#864 Sticky filters
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Jun 20, 2017
1 parent 0dd03f6 commit 4e8ab20
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/assets/css/inputs.css
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ button, .btn {
padding-left: 1rem;
}

.btn-meta-disabled,
.btn-meta-disabled:hover,
.btn-meta-disabled:focus,
.btn-meta-disabled:active {
background-color: $brand-dark-color;
color: $brand-font-color;
outline: none;
box-shadow:none;
border:0;
}


/*
* CUSTOM CHECKBOX
Expand Down
13 changes: 11 additions & 2 deletions src/components/filters/Filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';

import FiltersFrequent from './FiltersFrequent';
import FiltersNotFrequent from './FiltersNotFrequent';
import FiltersStatic from './FiltersStatic';

class Filters extends Component {
constructor(props) {
Expand Down Expand Up @@ -89,7 +90,9 @@ class Filters extends Component {
sortFilters = (data) => {
return {
frequentFilters: data.filter(filter => filter.frequent),
notFrequentFilters: data.filter(filter => !filter.frequent)
notFrequentFilters: data.filter(filter =>
!filter.frequent && !filter.static),
staticFilters: data.filter(filter => filter.static)
}
}

Expand All @@ -116,7 +119,7 @@ class Filters extends Component {
render() {
const {filterData, windowType, viewId} = this.props;
const {
frequentFilters, notFrequentFilters
frequentFilters, notFrequentFilters, staticFilters
} = this.sortFilters(filterData);
const {notValidFields, widgetShown, filter} = this.state;
return (
Expand Down Expand Up @@ -151,6 +154,12 @@ class Filters extends Component {
dropdownToggled={this.dropdownToggled}
/>
}
{!!staticFilters.length &&
<FiltersStatic
data={staticFilters}
clearFilters={this.clearFilters}
/>
}
</div>
</div>
)
Expand Down
35 changes: 35 additions & 0 deletions src/components/filters/FiltersStatic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { Component } from 'react';

class FiltersStatic extends Component {
constructor(props) {
super(props);
}

render() {
const {data, clearFilters} = this.props;
return (
<div className="filter-wrapper">
{data.map((item, index) => {
return (
<div className="filter-wrapper" key={index}>
<button
className={
'btn btn-meta-disabled ' +
'btn-distance btn-sm'
}
onClick={clearFilters}
>
<i
className="meta-icon-trash"
/>
{item.caption}
</button>
</div>);
})
}
</div>
);
}
}

export default FiltersStatic;

0 comments on commit 4e8ab20

Please sign in to comment.