mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-27 09:33:42 +01:00
[Glitch] Fix props for <Button>
Port d088964761
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
02f9ce9ce3
commit
0ab212f6a9
1 changed files with 9 additions and 8 deletions
|
@ -1,26 +1,26 @@
|
||||||
|
import type { PropsWithChildren } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
interface BaseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
interface BaseProps
|
||||||
|
extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
||||||
block?: boolean;
|
block?: boolean;
|
||||||
secondary?: boolean;
|
secondary?: boolean;
|
||||||
text?: JSX.Element;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PropsWithChildren extends BaseProps {
|
interface PropsChildren extends PropsWithChildren<BaseProps> {
|
||||||
text?: never;
|
text?: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PropsWithText extends BaseProps {
|
interface PropsWithText extends BaseProps {
|
||||||
text: JSX.Element;
|
text: JSX.Element | string;
|
||||||
children: never;
|
children?: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = PropsWithText | PropsWithChildren;
|
type Props = PropsWithText | PropsChildren;
|
||||||
|
|
||||||
export const Button: React.FC<Props> = ({
|
export const Button: React.FC<Props> = ({
|
||||||
text,
|
|
||||||
type = 'button',
|
type = 'button',
|
||||||
onClick,
|
onClick,
|
||||||
disabled,
|
disabled,
|
||||||
|
@ -28,6 +28,7 @@ export const Button: React.FC<Props> = ({
|
||||||
secondary,
|
secondary,
|
||||||
className,
|
className,
|
||||||
title,
|
title,
|
||||||
|
text,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
|
|
Loading…
Reference in a new issue