fix(Button): add types to DialogButton

also remove useless Button component.
This commit is contained in:
AAGaming
2022-09-18 15:01:40 -04:00
parent 31b81f5edd
commit 29201fadaf

View File

@@ -2,29 +2,20 @@ import { CSSProperties, FC } from 'react';
import { CommonUIModule } from '../webpack';
export interface ButtonProps {
export interface DialogButtonProps {
label?: string;
style: CSSProperties;
className?: string;
noFocusRing?: boolean;
disabled?: boolean;
description?: string;
layout?: 'below';
onClick?(e: MouseEvent): void;
onPointerDown?(e: PointerEvent): void;
onPointerUp?(e: PointerEvent): void;
onPointerCancel?(e: PointerEvent): void;
onMouseDown?(e: PointerEvent): void;
onMouseUp?(e: MouseEvent): void;
onTouchStart?(e: TouchEvent): void;
onTouchEnd?(e: TouchEvent): void;
onTouchCancel?(e: TouchEvent): void;
onSubmit?(e: SubmitEvent): void;
disabled?: boolean;
bottomSeparator?: boolean;
}
export const DialogButton = Object.values(CommonUIModule).find(
(mod: any) =>
mod?.render?.toString()?.includes('Object.assign({type:"button"') &&
mod?.render?.toString()?.includes('DialogButton'),
) as any;
// Button isn't exported, so call DialogButton to grab it
export const Button = DialogButton!.render({}).type as FC<ButtonProps>; // its actually a forwarded ref but that doesn't really matter in usage
) as FC<DialogButtonProps>;