forked from crowetic/commerce
Adding Click Outside
This commit is contained in:
parent
6020d5cfd2
commit
3f5045d3a8
@ -11,11 +11,9 @@ const ClickOutside = (
|
|||||||
{ active = true, onClick, children }: ClickOutsideProps,
|
{ active = true, onClick, children }: ClickOutsideProps,
|
||||||
ref: Ref<HTMLDivElement> | null | any = {}
|
ref: Ref<HTMLDivElement> | null | any = {}
|
||||||
) => {
|
) => {
|
||||||
console.log('--------', active, '-----------')
|
|
||||||
const innerRef = ref?.current
|
const innerRef = ref?.current
|
||||||
|
|
||||||
const handleClick = (event: any) => {
|
const handleClick = (event: any) => {
|
||||||
console.log(innerRef, event.target)
|
|
||||||
if (!hasParent(event.target, innerRef)) {
|
if (!hasParent(event.target, innerRef)) {
|
||||||
if (typeof onClick === 'function') {
|
if (typeof onClick === 'function') {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user