export default function Button()

in source/app/components/Button/Button.js [37:85]


export default function Button({
  children,
  className,
  disabled = false,
  inverted = false,
  link,
  onClick = null,
  palette = 'orange',
  simple = false,
  ...otherProps
}) {
  const { target, ...linkProps } = link || {}
  const buttonClassNames = classNames(css.button, css[palette], className, {
    [css.disabled]: disabled,
    [css.inverted]: inverted && !simple,
    [css.simple]: simple,
  })
  onClick = disabled ? () => false : onClick

  if (otherProps.href) {
    return (
      <a
        className={buttonClassNames}
        target={target || null}
        tabIndex={disabled ? -1 : null}
        {...otherProps}
      >
        {children}
      </a>
    )
  }

  return !disabled && link ? (
    <Link {...linkProps}>
      <a
        className={buttonClassNames}
        target={target || null}
        tabIndex={disabled ? -1 : null}
        {...otherProps}
      >
        {children}
      </a>
    </Link>
  ) : (
    <button className={buttonClassNames} onClick={onClick} tabIndex={disabled ? -1 : null} {...otherProps}>
      {children}
    </button>
  )
}