diff --git a/CHANGELOG.md b/CHANGELOG.md index fbec415f..6c34610c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added +- `closeModal` function to the `Attribute` component and to the close button. + ## [2.8.0] - 2021-04-29 ### Removed diff --git a/react/components/Autocomplete/components/ItemList/Attribute.tsx b/react/components/Autocomplete/components/ItemList/Attribute.tsx index 86ee7b36..a11b6f97 100644 --- a/react/components/Autocomplete/components/ItemList/Attribute.tsx +++ b/react/components/Autocomplete/components/ItemList/Attribute.tsx @@ -8,6 +8,7 @@ interface IAttributeProps { item: Item onMouseOver: (ee: React.MouseEvent | React.FocusEvent, item: Item) => void onMouseOut: () => void + closeModal: () => void } const Attribute = (props: IAttributeProps) => @@ -26,6 +27,7 @@ const Attribute = (props: IAttributeProps) => className={`${stylesCss.itemListSubItemLink} c-on-base`} to={`/${props.item.value}/${attribute.value}`} query={`map=ft,${attribute.key}`} + onClick={() => props.closeModal()} > {attribute.label} diff --git a/react/components/Autocomplete/components/ItemList/ItemList.tsx b/react/components/Autocomplete/components/ItemList/ItemList.tsx index 3290b127..40749538 100644 --- a/react/components/Autocomplete/components/ItemList/ItemList.tsx +++ b/react/components/Autocomplete/components/ItemList/ItemList.tsx @@ -15,6 +15,7 @@ interface ItemListProps { onItemHover?: (item: Item | AttributeItem) => void showTitleOnEmpty?: boolean customPage?: string + closeModal: () => void } interface ItemListState { @@ -104,6 +105,7 @@ export class ItemList extends React.Component { item={item} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut} + closeModal={this.props.closeModal} /> ) diff --git a/react/components/Autocomplete/index.tsx b/react/components/Autocomplete/index.tsx index 40ef1f86..335dc0ac 100644 --- a/react/components/Autocomplete/index.tsx +++ b/react/components/Autocomplete/index.tsx @@ -426,6 +426,7 @@ class AutoComplete extends React.Component< this.closeModal() }} customPage={this.props.customPage} + closeModal={() => this.closeModal()} /> ) } @@ -455,6 +456,7 @@ class AutoComplete extends React.Component< this.closeModal() }} customPage={this.props.customPage} + closeModal={() => this.closeModal()} /> ) : null} @@ -474,6 +476,7 @@ class AutoComplete extends React.Component< this.closeModal() }} customPage={this.props.customPage} + closeModal={() => this.closeModal()} /> ) : null} @@ -610,7 +613,10 @@ class AutoComplete extends React.Component< {this.renderContent()} {this.props.isMobile ? ( - ) : null}