Hovercard: hide on click ref
This commit is contained in:
parent
aabb1abf97
commit
35fe2fa4fa
|
@ -6,6 +6,7 @@ exports[`<DisplayName /> renders display name + account name 1`] = `
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="hover-ref-wrapper"
|
className="hover-ref-wrapper"
|
||||||
|
onClick={[Function]}
|
||||||
onMouseEnter={[Function]}
|
onMouseEnter={[Function]}
|
||||||
onMouseLeave={[Function]}
|
onMouseLeave={[Function]}
|
||||||
>
|
>
|
||||||
|
|
|
@ -26,6 +26,13 @@ const handleMouseLeave = (dispatch) => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClick = (dispatch) => {
|
||||||
|
return e => {
|
||||||
|
showProfileHoverCard.cancel();
|
||||||
|
dispatch(closeProfileHoverCard(true));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const HoverRefWrapper = ({ accountId, children, inline }) => {
|
export const HoverRefWrapper = ({ accountId, children, inline }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const ref = useRef();
|
const ref = useRef();
|
||||||
|
@ -37,6 +44,7 @@ export const HoverRefWrapper = ({ accountId, children, inline }) => {
|
||||||
className='hover-ref-wrapper'
|
className='hover-ref-wrapper'
|
||||||
onMouseEnter={handleMouseEnter(dispatch, ref, accountId)}
|
onMouseEnter={handleMouseEnter(dispatch, ref, accountId)}
|
||||||
onMouseLeave={handleMouseLeave(dispatch)}
|
onMouseLeave={handleMouseLeave(dispatch)}
|
||||||
|
onClick={handleClick(dispatch)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Elem>
|
</Elem>
|
||||||
|
|
|
@ -106,15 +106,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailed-status {
|
|
||||||
.profile-hover-card {
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hide the popper when the reference is hidden */
|
/* Hide the popper when the reference is hidden */
|
||||||
#popper[data-popper-reference-hidden] {
|
.profile-hover-card[data-popper-reference-hidden] {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue