Skip to content

Commit

Permalink
Merge pull request #137 from vtex-apps/feature/add-missing-closemenu
Browse files Browse the repository at this point in the history
Feature/add missing closemenu
  • Loading branch information
hiagolcm authored Jun 29, 2021
2 parents fa959df + c0d287e commit 31cf634
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface ItemListProps {
onItemHover?: (item: Item | AttributeItem) => void
showTitleOnEmpty?: boolean
customPage?: string
closeModal: () => void
}

interface ItemListState {
Expand Down Expand Up @@ -104,6 +105,7 @@ export class ItemList extends React.Component<ItemListProps> {
item={item}
onMouseOver={this.handleMouseOver}
onMouseOut={this.handleMouseOut}
closeModal={this.props.closeModal}
/>
</li>
)
Expand Down
8 changes: 7 additions & 1 deletion react/components/Autocomplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ class AutoComplete extends React.Component<
this.closeModal()
}}
customPage={this.props.customPage}
closeModal={() => this.closeModal()}
/>
)
}
Expand Down Expand Up @@ -455,6 +456,7 @@ class AutoComplete extends React.Component<
this.closeModal()
}}
customPage={this.props.customPage}
closeModal={() => this.closeModal()}
/>
) : null}

Expand All @@ -474,6 +476,7 @@ class AutoComplete extends React.Component<
this.closeModal()
}}
customPage={this.props.customPage}
closeModal={() => this.closeModal()}
/>
) : null}
</div>
Expand Down Expand Up @@ -610,7 +613,10 @@ class AutoComplete extends React.Component<
<ProductListProvider listName="autocomplete-result-list">
{this.renderContent()}
{this.props.isMobile ? (
<button className={stylesCss['close-btn']}>
<button
onClick={() => this.closeModal()}
className={stylesCss['close-btn']}
>
<IconClose />
</button>
) : null}
Expand Down

0 comments on commit 31cf634

Please sign in to comment.