Files
blitzkit/packages/website/src/components/ModuleButtons/GenericTankComponentButton.tsx
T

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-12-27 18:45:09 -06:00
import type { HTMLAttributes } from "react";
2024-02-12 19:24:34 -06:00
import {
TankComponentButton,
2024-09-22 21:12:18 -05:00
type TankComponentButtonProps,
2025-12-27 18:45:09 -06:00
} from "./TankComponentButton";
2024-02-12 19:24:34 -06:00
interface GenericTankComponentButtonProps extends TankComponentButtonProps {
icon: string;
2025-12-27 18:45:09 -06:00
iconStyles?: HTMLAttributes<HTMLImageElement>["style"];
2024-02-12 19:24:34 -06:00
}
export function GenericTankComponentButton({
icon,
iconStyles,
2024-02-13 09:40:00 -06:00
children,
2024-02-12 19:24:34 -06:00
...props
}: GenericTankComponentButtonProps) {
return (
2024-02-13 09:40:00 -06:00
<TankComponentButton {...props}>
<div
2024-02-12 19:24:34 -06:00
style={{
2024-02-13 09:40:00 -06:00
width: 48,
height: 40,
2025-12-27 18:45:09 -06:00
position: "relative",
2024-02-12 19:24:34 -06:00
}}
2024-02-13 09:40:00 -06:00
>
<img
2024-05-04 16:28:12 -05:00
alt={icon}
2024-02-13 09:40:00 -06:00
draggable={false}
src={icon}
style={{
2025-12-27 18:45:09 -06:00
objectFit: "contain",
2024-02-13 09:40:00 -06:00
width: 32,
height: 32,
2025-12-27 18:45:09 -06:00
position: "absolute",
2024-02-13 09:40:00 -06:00
opacity: props.disabled ? 0.5 : 1,
2025-12-27 18:45:09 -06:00
transform: "translate(-50%, -50%) scale(0.75)",
top: "50%",
left: "50%",
2024-02-13 09:40:00 -06:00
...iconStyles,
}}
/>
</div>
{children}
2024-02-12 19:24:34 -06:00
</TankComponentButton>
);
2025-12-27 18:45:09 -06:00
}