import { cx } from '../../lib/classNames'; import Link from 'next/link'; import { type ButtonHTMLAttributes, type FC, type HTMLAttributes, type MouseEventHandler, type ReactNode } from 'react'; import styles from './Button.module.css'; import { type IconProp, Icon, type IconColor } from '../../icons'; import type { RefProp } from '../../lib/react'; export interface CommonButtonProps extends Pick, 'aria-label' | 'className'> { children?: ReactNode, icon?: IconProp, iconColor?: IconColor, appearance?: 'primary' | 'secondary' | 'tertiary' | 'menu', flex?: boolean, intent?: 'delete', iconOnly?: boolean, } export interface ButtonProps extends CommonButtonProps, RefProp, Pick, 'disabled' | 'form' | 'name' | 'value' | 'formAction' | 'aria-label'> { type?: 'button' | 'submit', onClick?: MouseEventHandler, } export const Button: FC = ({ ref, children, icon, iconColor, appearance = 'secondary', flex, intent, iconOnly, onClick, className, type = 'button', ...props }) => { return ( ); }; export interface LinkButtonProps extends CommonButtonProps, RefProp, Pick, 'target' | 'rel'> { onClick?: MouseEventHandler, href: string, locale?: string | false, prefetch?: boolean, external?: boolean, } export const LinkButton: FC = ({ ref, children, icon, iconColor, appearance = 'secondary', flex, intent, iconOnly, className, external, ...props }) => { const LinkElement = external ? 'a' : Link; return ( {icon && } {children} ); };