umami/src/components/common/LinkButton.tsx

31 lines
698 B
TypeScript
Raw Normal View History

2023-10-03 16:45:02 +00:00
import classNames from 'classnames';
2023-07-30 07:11:26 +00:00
import Link from 'next/link';
2023-10-03 16:45:02 +00:00
import { useLocale } from 'components/hooks';
2023-10-08 01:55:14 +00:00
import styles from './LinkButton.module.css';
2023-11-13 22:12:05 +00:00
import { ReactNode } from 'react';
2023-10-03 16:45:02 +00:00
2023-11-13 22:12:05 +00:00
export interface LinkButtonProps {
href: string;
className: string;
variant?: string;
scroll?: boolean;
children?: ReactNode;
}
export function LinkButton({ href, className, variant, scroll = true, children }: LinkButtonProps) {
2023-10-03 16:45:02 +00:00
const { dir } = useLocale();
2023-07-30 07:11:26 +00:00
return (
2023-10-15 20:12:29 +00:00
<Link
className={classNames(styles.button, className, { [styles[variant]]: true })}
href={href}
dir={dir}
2023-10-17 18:27:35 +00:00
scroll={scroll}
2023-10-15 20:12:29 +00:00
>
2023-10-08 01:55:14 +00:00
{children}
2023-07-30 07:11:26 +00:00
</Link>
);
}
export default LinkButton;