({
icon: Icon,
label,
isSelected,
onClick,
isLockTool = false,
})
| 10 | }; |
| 11 | |
| 12 | const ToolButton: React.FC<ToolButtonProps> = ({ |
| 13 | icon: Icon, |
| 14 | label, |
| 15 | isSelected, |
| 16 | onClick, |
| 17 | isLockTool = false, |
| 18 | }) => { |
| 19 | return ( |
| 20 | <button |
| 21 | onClick={onClick} |
| 22 | className={` |
| 23 | relative p-2 rounded-lg transition-all duration-200 group |
| 24 | ${ |
| 25 | isSelected |
| 26 | ? isLockTool |
| 27 | ? "bg-red-100 text-red-600 shadow-sm" |
| 28 | : "bg-blue-100 text-blue-600 shadow-sm" |
| 29 | : "text-gray-600 hover:bg-gray-100" |
| 30 | } |
| 31 | hover:scale-105 active:scale-95 |
| 32 | `} |
| 33 | aria-pressed={isSelected} |
| 34 | aria-label={label} |
| 35 | > |
| 36 | <Icon |
| 37 | size={18} |
| 38 | className={` |
| 39 | transition-transform duration-200 |
| 40 | ${isSelected ? "scale-110" : "group-hover:scale-105"} |
| 41 | `} |
| 42 | /> |
| 43 | <div |
| 44 | className="absolute -bottom-10 left-1/2 transform -translate-x-1/2 |
| 45 | bg-gray-900 text-white text-xs px-2 py-1 rounded |
| 46 | opacity-0 group-hover:opacity-100 transition-opacity duration-200 |
| 47 | pointer-events-none whitespace-nowrap z-10" |
| 48 | > |
| 49 | {label} |
| 50 | </div> |
| 51 | </button> |
| 52 | ); |
| 53 | }; |
| 54 | |
| 55 | export default ToolButton; |
nothing calls this directly
no outgoing calls
no test coverage detected