RWKV-Runner/frontend/src/components/ToolTipButton.tsx

30 lines
785 B
TypeScript
Raw Normal View History

2023-05-22 10:52:06 +08:00
import React, { FC, MouseEventHandler, ReactElement } from 'react';
import { Button, Tooltip } from '@fluentui/react-components';
2023-05-05 23:23:34 +08:00
2023-05-13 20:15:18 +08:00
export const ToolTipButton: FC<{
2023-05-19 10:08:28 +08:00
text?: string | null,
desc: string,
icon?: ReactElement,
size?: 'small' | 'medium' | 'large',
2023-05-19 20:10:30 +08:00
shape?: 'rounded' | 'circular' | 'square';
appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';
2023-05-19 10:08:28 +08:00
disabled?: boolean,
onClick?: MouseEventHandler
2023-05-13 20:15:18 +08:00
}> = ({
2023-05-22 10:52:06 +08:00
text,
desc,
icon,
size,
shape,
appearance,
disabled,
onClick
}) => {
2023-05-05 23:23:34 +08:00
return (
<Tooltip content={desc} showDelay={0} hideDelay={0} relationship="label">
2023-05-19 20:10:30 +08:00
<Button disabled={disabled} icon={icon} onClick={onClick} size={size} shape={shape}
2023-05-22 10:52:06 +08:00
appearance={appearance}>{text}</Button>
2023-05-05 23:23:34 +08:00
</Tooltip>
);
};