Files
dpage-editor/src/pages/editor/components/sidebar/ToolInstructions.tsx
T
2026-06-14 12:30:24 +03:30

51 lines
1.1 KiB
TypeScript

import { type ToolType } from "@/pages/editor/store/editorStore";
import {
ImageGallery,
VideoInput,
AudioInput,
LinkInput,
SelectInstruction,
RectangleInstruction,
TextInstruction,
StickerInstruction,
GridInstruction,
} from "./instructions";
type ToolInstructionsProps = {
tool: ToolType;
};
const ToolInstructions = ({ tool }: ToolInstructionsProps) => {
if (tool === "image") {
return <ImageGallery />;
}
if (tool === "video") {
return <VideoInput />;
}
if (tool === "audio") {
return <AudioInput />;
}
if (tool === "link") {
return <LinkInput />;
}
const simpleInstructions: Partial<Record<ToolType, React.ReactElement>> = {
select: <SelectInstruction />,
rectangle: <RectangleInstruction />,
line: <RectangleInstruction />,
arrow: <RectangleInstruction />,
"custom-shape": <RectangleInstruction />,
text: <TextInstruction />,
sticker: <StickerInstruction />,
grid: <GridInstruction />,
};
return simpleInstructions[tool] ?? null;
};
export default ToolInstructions;