website refactor
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import NextLink from 'next/link';
|
||||
import React, { ReactNode, AnchorHTMLAttributes } from 'react';
|
||||
|
||||
interface LinkProps {
|
||||
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
href: string;
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
variant?: 'primary' | 'secondary' | 'ghost';
|
||||
target?: '_blank' | '_self' | '_parent' | '_top';
|
||||
rel?: string;
|
||||
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
export function Link({
|
||||
@@ -16,7 +17,10 @@ export function Link({
|
||||
className = '',
|
||||
variant = 'primary',
|
||||
target = '_self',
|
||||
rel = ''
|
||||
rel = '',
|
||||
onClick,
|
||||
style,
|
||||
...props
|
||||
}: LinkProps) {
|
||||
const baseClasses = 'inline-flex items-center transition-colors';
|
||||
|
||||
@@ -33,13 +37,16 @@ export function Link({
|
||||
].filter(Boolean).join(' ');
|
||||
|
||||
return (
|
||||
<NextLink
|
||||
<a
|
||||
href={href}
|
||||
className={classes}
|
||||
target={target}
|
||||
rel={rel}
|
||||
onClick={onClick}
|
||||
style={style}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</NextLink>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user