47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import { type ToolType } from "@/pages/editor/store/editorStore";
|
|
import {
|
|
ImageGallery,
|
|
VideoInput,
|
|
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 === "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;
|
|
|