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>
      )}
    </>
  );
}