diff --git a/src/pages/components/customButton.jsx b/src/pages/components/customButton.jsx index f6e2d23..7943f5a 100644 --- a/src/pages/components/customButton.jsx +++ b/src/pages/components/customButton.jsx @@ -1,12 +1,21 @@ import '../../css/customButton.css' import { useNavigate } from 'react-router-dom'; -function BlackButton({ text , to="/"}) { +function BlackButton({ text , to="/", onClick }) { const navigate = useNavigate(); + const handleClick = (e) => { + if (onClick) { + onClick(e); + } + if (!e.defaultPrevented && to) { + navigate(to, { replace: true }); + } + }; + return( - + ) } - -export default BlackButton \ No newline at end of file + +export default BlackButton