Files
dpage-editor/src/pages/editor/components/sidebar/ToolInstructions.tsx
T
hamid zarghami 3bfd5fd1eb base admin
2026-06-03 12:24:32 +03:30

52 lines
1.1 KiB
TypeScript

import { type ToolType } from "@/pages/editor/store/editorStore";
import {
ImageGallery,
VideoInput,
AudioInput,
LinkInput,
SelectInstruction,
RectangleInstruction,
TextInstruction,
LineInstruction,
ArrowInstruction,
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 />,
text: <TextInstruction />,
line: <LineInstruction />,
arrow: <ArrowInstruction />,
sticker: <StickerInstruction />,
grid: <GridInstruction />,
};
return simpleInstructions[tool] ?? null;
};
export default ToolInstructions;