fix: make LinkButton only pass href to Link
This commit is contained in:
parent
abadf0aae5
commit
d4e12c381d
1 changed files with 6 additions and 3 deletions
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue