import { ActionIcon, Button } from "@mantine/core"; import Tippy from "@tippyjs/react"; import { ForwardedRef, forwardRef, MouseEvent } from "react"; import { TooltipContent } from "../../Tooltip/components/TooltipContent"; import { IconType } from "react-icons"; export type ToolbarButtonProps = { onClick?: (e: MouseEvent) => void; icon?: IconType; mainTooltip: string; secondaryTooltip?: string; isSelected?: boolean; children?: any; isDisabled?: boolean; }; /** * Helper for basic buttons that show in the formatting toolbar. */ export const ToolbarButton = forwardRef( (props: ToolbarButtonProps, ref: ForwardedRef) => { const ButtonIcon = props.icon; return ( } trigger={"mouseenter"}> {/*Creates an ActionIcon instead of a Button if only an icon is provided as content.*/} {props.children ? ( ) : ( {ButtonIcon && } )} ); } );