fix: make LinkButton only pass href to Link

This commit is contained in:
Ashhhleyyy 2022-08-01 17:17:59 +01:00
parent abadf0aae5
commit d4e12c381d
Signed by: ash
GPG key ID: 83B789081A0878FB

View file

@ -4,6 +4,7 @@ import {
DetailedHTMLProps,
} from 'react';
import Link from 'next/link';
import { UrlObject } from 'url';
interface CustomProps {
noDefaultColous?: boolean;
@ -38,11 +39,13 @@ export default function Button({
return <button className={classes.join(' ')} {...props} />;
}
type LinkButtonProps = AnchorHTMLAttributes<HTMLAnchorElement>;
type LinkButtonProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
href: string | UrlObject;
};
export function LinkButton({ className, children, ...props }: LinkButtonProps) {
export function LinkButton({ className, children, href, ...props }: LinkButtonProps) {
return (
<Link href={props.href || ''}>
<Link href={href}>
<a
className={'text-blue-200 hover:underline ' + (className || '')}
{...props}