2023-05-13 20:15:18 +08:00
|
|
|
import React, {FC, MouseEventHandler, ReactElement} from 'react';
|
2023-05-05 23:23:34 +08:00
|
|
|
import {Button, Tooltip} from '@fluentui/react-components';
|
|
|
|
|
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',
|
|
|
|
disabled?: boolean,
|
|
|
|
onClick?: MouseEventHandler
|
2023-05-13 20:15:18 +08:00
|
|
|
}> = ({
|
|
|
|
text,
|
|
|
|
desc,
|
|
|
|
icon,
|
2023-05-19 10:08:28 +08:00
|
|
|
size,
|
|
|
|
disabled,
|
2023-05-13 20:15:18 +08:00
|
|
|
onClick
|
|
|
|
}) => {
|
2023-05-05 23:23:34 +08:00
|
|
|
return (
|
|
|
|
<Tooltip content={desc} showDelay={0} hideDelay={0} relationship="label">
|
2023-05-19 10:08:28 +08:00
|
|
|
<Button disabled={disabled} icon={icon} onClick={onClick} size={size}>{text}</Button>
|
2023-05-05 23:23:34 +08:00
|
|
|
</Tooltip>
|
|
|
|
);
|
|
|
|
};
|