-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #681 from vtex-apps/fix/filter-sidebar-close
Fix: filter sidebar closes when clicking shipping option drawer
- Loading branch information
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const SHIPPING_OPTION_COMPONENT_DRAWER_CLASS = | ||
'vtex-shipping-option-components-0-x-drawer' | ||
|
||
const SHIPPING_OPTION_COMPONENT_OVERLAY_CLASS = | ||
'vtex-shipping-option-components-0-x-overlay' | ||
|
||
const isShippingOptionsComponent = e => { | ||
if (!e.target) { | ||
return false | ||
} | ||
|
||
const shippingOptionsDawerElement = e.target.closest( | ||
`.${SHIPPING_OPTION_COMPONENT_DRAWER_CLASS}` | ||
) | ||
|
||
const isShippingOptionsOverlayElement = e.target.classList.contains( | ||
SHIPPING_OPTION_COMPONENT_OVERLAY_CLASS | ||
) | ||
|
||
return shippingOptionsDawerElement || isShippingOptionsOverlayElement | ||
} | ||
|
||
export default isShippingOptionsComponent |