toolbar and grid

This commit is contained in:
Conzer 2024-12-04 03:22:18 -05:00
parent c5638832a7
commit 99d9f34ffd
2 changed files with 27 additions and 1 deletions

View file

@ -0,0 +1,15 @@
import React from 'react';
import { Rect } from 'react-konva';
const Grid = ({ gridSize, canvasSize }) => {
const lines = [];
for (let i = 0; i <= canvasSize; i += gridSize) {
lines.push(
<Rect key={`v-${i}`} x={i} y={0} width={1} height={canvasSize} fill="lightgray" />,
<Rect key={`h-${i}`} x={0} y={i} width={canvasSize} height={1} fill="lightgray" />
);
}
return lines;
};
export default Grid;

View file

@ -1 +1,12 @@
import React from 'react';
import React from 'react';
const Toolbar = ({ setTool }) => {
return (
<div className="toolbar">
<button onClick={() => setTool('draw')}>Draw</button>
<button onClick={() => setTool('erase')}>Erase</button>
</div>
);
};
export default Toolbar;