31 lines
649 B
TypeScript
31 lines
649 B
TypeScript
import type { AnchorHTMLAttributes } from "react";
|
|
import {
|
|
buttonClassName,
|
|
type ButtonStyleOptions,
|
|
} from "./button-variants";
|
|
|
|
export type ButtonLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> &
|
|
ButtonStyleOptions;
|
|
|
|
/**
|
|
* 外链按钮:用于邮件、社交链接等外部地址。
|
|
* 站内跳转请使用 next-intl 的 <Link> 并传入 buttonClassName()。
|
|
*/
|
|
export function ButtonLink({
|
|
className,
|
|
variant,
|
|
size,
|
|
rel = "noopener noreferrer",
|
|
target = "_blank",
|
|
...props
|
|
}: ButtonLinkProps) {
|
|
return (
|
|
<a
|
|
rel={rel}
|
|
target={target}
|
|
className={buttonClassName({ className, variant, size })}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|