fix void link for user address link

This commit is contained in:
plebeius.eth
2023-08-22 11:49:04 +02:00
parent b4692dc37c
commit b75cedffd5
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -3,7 +3,16 @@ import { Link } from "react-router-dom";
const ForwardRefLink = React.forwardRef((props, ref) => {
const { children, setRefAndCid, onMouseOver, onMouseLeave, onClick, ...otherProps } = props;
const handleClick = (event) => {
if (otherProps.to === "#void") {
event.preventDefault();
}
if (onClick) {
onClick(event);
}
};
useEffect(() => {
if (ref.current && typeof setRefAndCid === 'function') {
setRefAndCid(ref.current);
@@ -16,7 +25,7 @@ const ForwardRefLink = React.forwardRef((props, ref) => {
{...otherProps}
onMouseOver={onMouseOver}
onMouseLeave={onMouseLeave}
onClick={onClick}
onClick={handleClick}
>
{children}
</Link>