File size: 927 Bytes
d092f57 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import { FC, ReactNode } from "react"
import InteractionHandler from "../action/InteractionHandler"
import classNames from "classnames"
interface Props {
tooltip: string
className?: string
onClick: () => void
interaction: (touch: boolean) => void
children?: ReactNode
}
const ControlButton: FC<Props> = ({
tooltip,
className,
onClick,
interaction,
children,
}) => {
return (
<InteractionHandler
tooltip={tooltip}
className={classNames(
"action cursor-pointer rounded p-2 select-none",
className
)}
onClick={(e, touch) => {
e.preventDefault()
e.stopPropagation()
onClick()
interaction(touch)
}}
onMove={(e, touch) => {
e.preventDefault()
e.stopPropagation()
interaction(touch)
}}
prevent={true}
>
{children}
</InteractionHandler>
)
}
export default ControlButton
|