import { useRouter } from "next/router"; import { MouseEventHandler } from "react"; interface Props { id?: string; className?: string; href?: string; children: React.ReactNode; active?: boolean; locale?: string; target?: "_blank"; onClick?: MouseEventHandler; draggable?: boolean; } export default function Button(props: Props): JSX.Element { const router = useRouter(); const button = (
{props.children}
); if (props.target) { return (
{button}
); } return (
{ if (props.href || props.locale) router.push(props.href ?? router.asPath, props.href, { locale: props.locale, }); }} > {button}
); }