Skip to content

Commit 1df1baa

Browse files
committed
initial commit
1 parent 5149e52 commit 1df1baa

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/components/core/filters/filter-group.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export default class FilterGroup extends Component {
2323
}, 0);
2424
};
2525

26+
getExpandedState = () => {
27+
return this.props.initialyExpanded ? !this.state.expanded : this.state.expanded;
28+
}
29+
2630
toggleExpansion = () => this.setState({ expanded: !this.state.expanded });
2731

2832
render() {
@@ -31,7 +35,7 @@ export default class FilterGroup extends Component {
3135
onClearFacet = () => {},
3236
onSelectFacet = () => {},
3337
} = this.props;
34-
const { expanded } = this.state;
38+
const expanded = this.getExpandedState();
3539

3640
const updatedChildren = React.Children.map(children, (child) => {
3741
return React.cloneElement(child, { onSelectFacet, term, values });

src/components/core/filters/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ export type FilterGroupProps = {
2626
values?: Array<FilterValue>,
2727
onClearFacet?: Function,
2828
onSelectFacet?: Function,
29+
initialyExpanded?: boolean,
2930
};

0 commit comments

Comments
 (0)