Files
artcraft/app/components/ButtonIcon.tsx
T
wilandwil e11b1fb255 Play Button Icon and Functions (#283)
Play Button Icon and Functions
- Play Button changes icon depending on playback state
- Play Button can toggle between playing and pausing playback
- When Paused, current playtime wont be changed
- When Resumed, it resumes playing from where the play cursor is

Co-authored-by: wil <wil@storyteller.ai>
2024-05-01 12:34:55 -04:00

40 lines
1020 B
TypeScript

import {
FontAwesomeIcon,
FontAwesomeIconProps,
} from "@fortawesome/react-fontawesome";
import { twMerge } from "tailwind-merge";
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
interface ButtonIconProps extends FontAwesomeIconProps {
icon: IconDefinition;
onClick: () => void;
className?: string;
hoverFill?: boolean;
disabled?: boolean;
}
export const ButtonIcon = ({
icon,
size,
onClick,
className: propsClassName,
hoverFill = false,
disabled,
...rest
}: ButtonIconProps) => {
const className = twMerge(
"flex h-8 w-8 items-center justify-center rounded-lg transition-all duration-150",
hoverFill
? "bg-ui-controls-button hover:bg-ui-controls-button/[0.75]"
: "bg-transparent hover:bg-ui-panel/[0.4]",
disabled && "opacity-50 hover:bg-transparent",
propsClassName,
);
return (
<button className={className} onClick={onClick} disabled={disabled}>
<FontAwesomeIcon icon={icon} size={size} {...rest}/>
</button>
);
};