You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/frontend/src/components/inputs/Action.tsx

34 lines
903 B

import { IconDefinition } from "@fortawesome/fontawesome-common-types";
import {
FontAwesomeIcon,
FontAwesomeIconProps,
} from "@fortawesome/react-fontawesome";
import {
ActionIcon,
ActionIconProps,
Tooltip,
TooltipProps,
} from "@mantine/core";
import { forwardRef } from "react";
export type ActionProps = ActionIconProps<"button"> & {
icon: IconDefinition;
label: string;
tooltip?: Omit<TooltipProps, "label" | "children">;
iconProps?: Omit<FontAwesomeIconProps, "icon">;
};
const Action = forwardRef<HTMLButtonElement, ActionProps>(
({ icon, iconProps, label, tooltip, ...props }, ref) => {
return (
<Tooltip openDelay={1500} {...tooltip} label={label}>
<ActionIcon aria-label={label} {...props} ref={ref}>
<FontAwesomeIcon icon={icon} {...iconProps}></FontAwesomeIcon>
</ActionIcon>
</Tooltip>
);
}
);
export default Action;