diff --git a/src/components/Button.tsx b/src/components/Button.tsx index a968847..8da4382 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,4 +1,4 @@ -import Link from "next/link"; +import { useRouter } from "next/router"; import { MouseEventHandler } from "react"; type ButtonProps = { @@ -12,6 +12,8 @@ type ButtonProps = { }; export default function Button(props: ButtonProps): JSX.Element { + const router = useRouter(); + const button = (
); - const result = props.href ? ( - + return ( +
{ + if (props.href || props.locale) + router.push(props.href ?? router.asPath, props.href, { + locale: props.locale, + }); + }} + > {button} - - ) : ( - button +
); - return result; }