Some small changes

This commit is contained in:
Gregory Schier
2023-03-14 00:08:03 -07:00
parent f81a3ae8e7
commit debd3c8185
7 changed files with 80 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
import classnames from 'classnames';
import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
import type { HTMLAttributes } from 'react';
import { forwardRef } from 'react';
import { Link } from 'react-router-dom';
import { Icon } from './Icon';
@@ -14,22 +14,13 @@ const colorStyles = {
danger: 'bg-red-400 text-white hover:bg-red-500',
};
export type ButtonProps = {
export type ButtonProps = HTMLAttributes<HTMLElement> & {
to?: string;
color?: keyof typeof colorStyles;
size?: 'sm' | 'md';
justify?: 'start' | 'center';
type?: 'button' | 'submit';
onClick?: (event: MouseEvent<HTMLElement>) => void;
onDoubleClick?: (event: MouseEvent<HTMLElement>) => void;
contentEditable?: boolean;
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
forDropdown?: boolean;
className?: string;
children?: ReactNode;
disabled?: boolean;
title?: string;
tabIndex?: number;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View File

@@ -1,13 +0,0 @@
import classnames from 'classnames';
import type { ButtonProps } from './Button';
import { Button } from './Button';
type Props = ButtonProps & {
to: string;
};
export function ButtonLink({ to, className, ...buttonProps }: Props) {
return (
<Button to={to} className={classnames(className, 'w-full')} tabIndex={-1} {...buttonProps} />
);
}