Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 25x 25x 25x | import type { EditorTool, ShapeType } from '@/shared/types';
import {
ICON_COLORS,
ICON_MAP,
resolveIconKey,
type SystemIconName,
} from '@/shared/constants';
export interface ToolIconProps {
type: EditorTool | null;
shapeType?: ShapeType;
iconName?: SystemIconName | string;
className?: string;
}
export function ToolIcon({ type, shapeType, iconName, className }: ToolIconProps) {
const key = resolveIconKey(type, shapeType, iconName);
const Icon = ICON_MAP[key as keyof typeof ICON_MAP];
const color = ICON_COLORS[key as keyof typeof ICON_COLORS] ?? ICON_COLORS.DEFAULT;
return (
<div className="p-1 rounded" data-testid="tool-icon">
<Icon className={`${className || 'w-4 h-4'} ${color}`} />
</div>
);
}
|