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

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-09-21 20:26:58 -05: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,
2024-02-12 19:24:34 -06:00
} from './TankComponentButton';
interface GenericTankComponentButtonProps extends TankComponentButtonProps {
icon: string;
iconStyles?: HTMLAttributes<HTMLImageElement>['style'];
}
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,
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={{
2024-02-13 19:46:34 -06:00
objectFit: 'contain',
2024-02-13 09:40:00 -06:00
width: 32,
height: 32,
position: 'absolute',
opacity: props.disabled ? 0.5 : 1,
2025-12-28 12:12:56 +13:00
transform: 'translate(-50%, -50%) scale(1)',
2024-02-13 09:40:00 -06:00
top: '50%',
left: '50%',
...iconStyles,
}}
/>
</div>
{children}
2024-02-12 19:24:34 -06:00
</TankComponentButton>
);
2025-12-28 12:12:56 +13:00
}