mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 14:44:12 +00:00
refactor: move components into folders
This commit is contained in:
parent
1dbb126b90
commit
ceb87c2088
8 changed files with 15 additions and 8 deletions
35
src/components/toolbar/index.tsx
Normal file
35
src/components/toolbar/index.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { useContext } from "react";
|
||||
import { EraserIcon, HandIcon, PencilIcon, ZoomInIcon } from "lucide-react";
|
||||
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import { ToolContext } from "@/context/ToolContext";
|
||||
|
||||
function Toolbar() {
|
||||
const { tool, setTool } = useContext(ToolContext);
|
||||
|
||||
const onToolChange = (value: string) => setTool(value as Tool);
|
||||
|
||||
return (
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
value={tool}
|
||||
onValueChange={onToolChange}
|
||||
className="flex flex-col justify-start py-1 border-r border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950"
|
||||
>
|
||||
<ToggleGroupItem value="hand" className="!p-0 !h-8 !min-w-8">
|
||||
<HandIcon />
|
||||
</ToggleGroupItem>
|
||||
<ToggleGroupItem value="pencil" className="!p-0 !h-8 !min-w-8">
|
||||
<PencilIcon />
|
||||
</ToggleGroupItem>
|
||||
<ToggleGroupItem value="eraser" className="!p-0 !h-8 !min-w-8">
|
||||
<EraserIcon />
|
||||
</ToggleGroupItem>
|
||||
<ToggleGroupItem value="zoom" className="!p-0 !h-8 !min-w-8">
|
||||
<ZoomInIcon />
|
||||
</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
);
|
||||
}
|
||||
|
||||
export default Toolbar;
|
||||
Loading…
Add table
Add a link
Reference in a new issue