diff --git a/app/javascript/flavours/glitch/components/button.tsx b/app/javascript/flavours/glitch/components/button.tsx index 0b6a0f267e..c76aaea42f 100644 --- a/app/javascript/flavours/glitch/components/button.tsx +++ b/app/javascript/flavours/glitch/components/button.tsx @@ -1,26 +1,26 @@ +import type { PropsWithChildren } from 'react'; import { useCallback } from 'react'; import classNames from 'classnames'; -interface BaseProps extends React.ButtonHTMLAttributes { +interface BaseProps + extends Omit, 'children'> { block?: boolean; secondary?: boolean; - text?: JSX.Element; } -interface PropsWithChildren extends BaseProps { - text?: never; +interface PropsChildren extends PropsWithChildren { + text?: undefined; } interface PropsWithText extends BaseProps { - text: JSX.Element; - children: never; + text: JSX.Element | string; + children?: undefined; } -type Props = PropsWithText | PropsWithChildren; +type Props = PropsWithText | PropsChildren; export const Button: React.FC = ({ - text, type = 'button', onClick, disabled, @@ -28,6 +28,7 @@ export const Button: React.FC = ({ secondary, className, title, + text, children, ...props }) => {