2024-09-21 20:26:58 -05:00
|
|
|
import type { HTMLAttributes } from 'react';
|
2024-02-12 19:24:34 -06:00
|
|
|
import {
|
|
|
|
|
TankComponentButton,
|
|
|
|
|
TankComponentButtonProps,
|
|
|
|
|
} 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,
|
|
|
|
|
transform: 'translate(-50%, -50%) scale(0.75)',
|
|
|
|
|
top: '50%',
|
|
|
|
|
left: '50%',
|
|
|
|
|
...iconStyles,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{children}
|
2024-02-12 19:24:34 -06:00
|
|
|
</TankComponentButton>
|
|
|
|
|
);
|
|
|
|
|
}
|