2022-05-10 13:52:06 +00:00
|
|
|
import { h, JSX } from 'preact';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for ControlButton.
|
|
|
|
*/
|
|
|
|
export interface ControlButtonProps {
|
|
|
|
icon: string;
|
|
|
|
title: string;
|
2022-05-15 21:57:21 +00:00
|
|
|
disabled?: boolean;
|
2022-05-10 13:52:06 +00:00
|
|
|
onClick: JSX.MouseEventHandler<HTMLButtonElement>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Simple button with an icon, tooltip text and a callback.
|
|
|
|
*
|
|
|
|
* @param icon FontAwesome icon name
|
|
|
|
* @param title Tooltip text
|
|
|
|
* @param onClick Click callback
|
|
|
|
* @returns Control Button component
|
|
|
|
*/
|
2022-05-15 21:57:21 +00:00
|
|
|
export const ControlButton = ({ icon, title, onClick, ...props }: ControlButtonProps) => (
|
|
|
|
<button onClick={onClick} title={title} {...props} >
|
2022-05-29 20:48:51 +00:00
|
|
|
<i className={`fas fa-${icon}`}></i>
|
2022-05-10 13:52:06 +00:00
|
|
|
</button>
|
|
|
|
);
|