Files
readest/apps/readest-app/src/components/Button.tsx
T
Huang Xin 58c907c7cc Various enhancements for mobile platforms (#188)
* Larger area to toggle header/footer bar

* Don't show rounded window on web platform

* Disable tooltips on mobile platforms as there is no mouse pointer

* Dedupe voices from web speech API
2025-01-17 15:42:16 +01:00

48 lines
959 B
TypeScript

import React from 'react';
import clsx from 'clsx';
interface ButtonProps {
icon: React.ReactNode;
onClick: () => void;
disabled?: boolean;
tooltip?: string;
tooltipDirection?: 'top' | 'bottom' | 'left' | 'right';
className?: string;
}
const Button: React.FC<ButtonProps> = ({
icon,
onClick,
disabled = false,
tooltip,
tooltipDirection = 'top',
className,
}) => {
return (
<div
className={clsx(
'lg:tooltip z-50 h-8 min-h-8 w-8',
tooltip && `lg:tooltip-${tooltipDirection}`,
{
'tooltip-hidden': !tooltip,
},
)}
data-tip={tooltip}
>
<button
className={clsx(
'btn btn-ghost h-8 min-h-8 w-8 p-0',
disabled && 'btn-disabled !bg-transparent',
className,
)}
onClick={disabled ? undefined : onClick}
disabled={disabled}
>
{icon}
</button>
</div>
);
};
export default Button;