|
1 | | -import { MousePointer2, Pen, Eraser, Square, Circle, Minus, Trash2 } from "lucide-react"; |
| 1 | +import { |
| 2 | + MousePointer2, |
| 3 | + Pen, |
| 4 | + Eraser, |
| 5 | + Square, |
| 6 | + Circle, |
| 7 | + Minus, |
| 8 | + Trash2, |
| 9 | +} from "lucide-react"; |
2 | 10 | import { cn } from "../lib/utils"; |
3 | 11 | import { Button } from "./ui/Button"; |
4 | 12 | import { Separator } from "./ui/Separator"; |
5 | 13 |
|
6 | 14 | export const Toolbar = ({ activeTool, onToolChange, onClear }) => { |
7 | | - const tools = [ |
8 | | - { type: "select", icon: MousePointer2 }, |
9 | | - { type: "pen", icon: Pen }, |
10 | | - { type: "eraser", icon: Eraser }, |
11 | | - { type: "rectangle", icon: Square }, |
12 | | - { type: "circle", icon: Circle }, |
13 | | - { type: "line", icon: Minus }, |
14 | | - ]; |
| 15 | + const tools = [ |
| 16 | + { type: "select", icon: MousePointer2 }, |
| 17 | + { type: "pen", icon: Pen }, |
| 18 | + { type: "eraser", icon: Eraser }, |
| 19 | + { type: "rectangle", icon: Square }, |
| 20 | + { type: "circle", icon: Circle }, |
| 21 | + { type: "line", icon: Minus }, |
| 22 | + ]; |
15 | 23 |
|
16 | | - return ( |
17 | | - <div className="fixed top-6 left-1/2 -translate-x-1/2 z-50"> |
18 | | - <div className="bg-toolbar border border-toolbar-border rounded-2xl shadow-xl backdrop-blur-sm p-2 flex items-center gap-2"> |
19 | | - {tools.map((tool) => { |
20 | | - const Icon = tool.icon; |
21 | | - return ( |
22 | | - <Button |
23 | | - key={tool.type} |
24 | | - variant="ghost" |
25 | | - size="icon" |
26 | | - onClick={() => onToolChange(tool.type)} |
27 | | - className={cn( |
28 | | - "h-10 w-10 transition-all duration-200 hover:bg-secondary", |
29 | | - activeTool === tool.type && "bg-primary text-primary-foreground hover:bg-primary/90" |
30 | | - )} |
31 | | - aria-label={tool.type} |
32 | | - > |
33 | | - <Icon className="h-5 w-5" /> |
34 | | - </Button> |
35 | | - ); |
36 | | - })} |
| 24 | + return ( |
| 25 | + <div className="fixed top-6 left-1/2 -translate-x-1/2 z-50"> |
| 26 | + <div className="bg-toolbar border border-toolbar-border rounded-2xl shadow-xl backdrop-blur-sm p-2 flex items-center gap-2"> |
| 27 | + {tools.map((tool) => { |
| 28 | + const Icon = tool.icon; |
| 29 | + return ( |
| 30 | + <Button |
| 31 | + key={tool.type} |
| 32 | + variant="ghost" |
| 33 | + size="icon" |
| 34 | + onClick={() => onToolChange(tool.type)} |
| 35 | + className={cn( |
| 36 | + "h-10 w-10 transition-all duration-200 hover:bg-secondary", |
| 37 | + activeTool === tool.type |
| 38 | + ? "bg-primary text-primary-foreground ring-2 ring-offset-2 ring-primary" |
| 39 | + : "" |
| 40 | + )} |
| 41 | + aria-label={tool.type} |
| 42 | + > |
| 43 | + <Icon className="h-5 w-5" /> |
| 44 | + </Button> |
| 45 | + ); |
| 46 | + })} |
37 | 47 |
|
38 | | - <Separator orientation="vertical" className="h-8 mx-1" /> |
| 48 | + <Separator orientation="vertical" className="h-8 mx-1" /> |
39 | 49 |
|
40 | | - <Button |
41 | | - variant="ghost" |
42 | | - size="icon" |
43 | | - onClick={onClear} |
44 | | - className="h-10 w-10 transition-all duration-200 hover:bg-destructive/10 hover:text-destructive" |
45 | | - aria-label="Clear canvas" |
46 | | - > |
47 | | - <Trash2 className="h-5 w-5" /> |
48 | | - </Button> |
49 | | - </div> |
50 | | - </div> |
51 | | - ); |
| 50 | + <Button |
| 51 | + variant="ghost" |
| 52 | + size="icon" |
| 53 | + onClick={onClear} |
| 54 | + className="h-10 w-10 transition-all duration-200 hover:bg-destructive/10 hover:text-destructive" |
| 55 | + aria-label="Clear canvas" |
| 56 | + > |
| 57 | + <Trash2 className="h-5 w-5" /> |
| 58 | + </Button> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + ); |
52 | 62 | }; |
0 commit comments