blob: 35292ba45b0f960e38465db618100209e4576ca2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import { Button, type ButtonProps } from '@umami/react-zen';
import Link from 'next/link';
import type { ReactNode } from 'react';
import { useLocale } from '@/components/hooks';
export interface LinkButtonProps extends ButtonProps {
href: string;
target?: string;
scroll?: boolean;
variant?: any;
prefetch?: boolean;
asAnchor?: boolean;
children?: ReactNode;
}
export function LinkButton({
href,
variant,
scroll = true,
target,
prefetch,
children,
asAnchor,
...props
}: LinkButtonProps) {
const { dir } = useLocale();
return (
<Button {...props} variant={variant} asChild>
{asAnchor ? (
<a href={href} target={target}>
{children}
</a>
) : (
<Link href={href} dir={dir} scroll={scroll} target={target} prefetch={prefetch}>
{children}
</Link>
)}
</Button>
);
}
|