diff --git a/components/Profile/AddBlock.tsx b/components/Profile/AddBlock.tsx index aedb0c1..41ec1e1 100644 --- a/components/Profile/AddBlock.tsx +++ b/components/Profile/AddBlock.tsx @@ -3,32 +3,17 @@ import React from "react"; import { FaPlus } from "react-icons/fa6"; +import { useBlock } from "@/hooks/toggle"; import TooltipButton from "../Reusable/Tooltip"; -import { BlockType, useBlock } from "../../hooks/toggle"; export const AddBlock = () => { - const { setDrawerOpen, addBoardBlock } = useBlock(); + const { setDrawerOpen, onOpenBlock } = useBlock(); const handleClick = (e: React.MouseEvent) => { e.preventDefault(); setDrawerOpen(true); - }; - const handleAddImageBlock = () => { - const imageBlock = { - id: 0, // You can set this to an appropriate value - type: "image" as const, // Type assertion to BlockType - items: [], // Add any initial data as needed - }; - addBoardBlock(imageBlock); + onOpenBlock("index"); }; - const handleAddTextBlock = () => { - const textBlock = { - id: 0, - type: "text" as const, - items: [], // Add any initial data as needed - }; - addBoardBlock(textBlock); - }; return (
diff --git a/components/Profile/BlockButton.tsx b/components/Profile/BlockButton.tsx index 4fbef22..e3eaeff 100644 --- a/components/Profile/BlockButton.tsx +++ b/components/Profile/BlockButton.tsx @@ -22,10 +22,13 @@ const BlockButton = ({ entry.hasOwnProperty(type) ) as IconEntry; + const handleOnClick = () => { + onOpenBlock(type); + }; return (
-