Skip to content

Commit 005c754

Browse files
committed
create TextEditor component
1 parent 8259e19 commit 005c754

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

client/src/App.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Sidebar from "./components/Sidebar";
1111
import Canvas from "./components/Canvas";
1212
import Menu from "./components/Menu";
1313
import EraserCursor from "./components/EraserCursor";
14+
import TextEditor from "./components/TextEditor";
1415
import { useRecoilValue, useRecoilState } from "recoil";
1516
import { eraserState, cursorPosition, canvasColors, canvasState } from "./atoms";
1617

@@ -32,7 +33,7 @@ function App() {
3233
useEffect(() => {
3334
if (!doc) {
3435
console.log("setting doc");
35-
const _doc = Y.Doc();
36+
const _doc = new Y.Doc();
3637
setDoc(_doc);
3738
}
3839
}, [doc]);
@@ -201,6 +202,7 @@ function App() {
201202
<Canvas canvasRef={canvasRef}></Canvas>
202203
{eraserMode && <EraserCursor></EraserCursor>}
203204
{showMenu && <Menu></Menu>}
205+
<TextEditor></TextEditor>
204206
</div>
205207
);
206208
}

client/src/components/TextEditor.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function TextEditor(){
2+
return (
3+
<div className="w-96 h-96 absolute shadow rounded absolute">
4+
<div className="bg-gray bg-slate-800 w-96 h-14 content-center">
5+
<h1 className="font-sans text-white text-lg justify-center flex">
6+
Plan your drawing
7+
</h1>
8+
</div>
9+
<textarea
10+
className="w-96 h-80 border rounded absolute focus:outline-none focus:ring-0 focus:border-transparent"
11+
placeholder="E.g. Make a painting with trees..."
12+
></textarea>
13+
</div>
14+
);
15+
}
16+
17+
export default TextEditor;

0 commit comments

Comments
 (0)