website/components/Button.tsx

28 lines
801 B
TypeScript
Raw Normal View History

2024-04-21 14:48:51 +00:00
import styles from '@/styles/Button.module.scss';
import Link from 'next/link';
type Props = {
href?: string;
children: React.ReactNode;
className?: string;
disabled?: boolean;
type: 'primary' | 'outlined';
[key: string]: any;
};
export default function Button({ href, children, className, disabled, type, ...props }: Props) {
return (
<>
{href ? (
<Link href={href} className={className ? `${className} ${styles.button}` : styles.button} data-type={type} data-disabled={disabled} {...props}>
{children}
</Link>
) : (
<button className={className ? `${className} ${styles.button}` : styles.button} disabled={disabled} data-type={type} data-disabled={disabled} {...props}>
{children}
</button>
)}
</>
);
}