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,
|
DetailedHTMLProps,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
import { UrlObject } from 'url';
|
||||||
|
|
||||||
interface CustomProps {
|
interface CustomProps {
|
||||||
noDefaultColous?: boolean;
|
noDefaultColous?: boolean;
|
||||||
|
@ -38,11 +39,13 @@ export default function Button({
|
||||||
return <button className={classes.join(' ')} {...props} />;
|
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 (
|
return (
|
||||||
<Link href={props.href || ''}>
|
<Link href={href}>
|
||||||
<a
|
<a
|
||||||
className={'text-blue-200 hover:underline ' + (className || '')}
|
className={'text-blue-200 hover:underline ' + (className || '')}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
Loading…
Reference in a new issue