Skip to content

Commit

Permalink
text area added
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed Apr 7, 2024
1 parent 647a187 commit 35808f9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState } from "react";
import FilesContext from "./FilesContext";
import FileTab from "./components/TopBar";
import OpenedFile from "./types/OpenedFile";
import Editor from "./components/Editor";

function App() {
const [files, setFiles] = useState<OpenedFile[]>([
Expand Down Expand Up @@ -51,6 +52,7 @@ function App() {
<FilesContext.Provider value={{ files, setFiles }}>
<div className="w-screen h-screen bg-slate-600">
<FileTab />
<Editor />
</div>
</FilesContext.Provider>
);
Expand Down
22 changes: 22 additions & 0 deletions src/components/Editor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ChangeEvent, useState } from "react";

function Editor() {
const [code, setCode] = useState<string>("// Start coding here...");

const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
setCode(event.target.value);
};

return (
<div className="code-editor">
<textarea
value={code}
onChange={handleChange}
className="code-editor-textarea"
placeholder="// Start coding here..."
/>
</div>
);
}

export default Editor;
10 changes: 10 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@
.scrollbar-thin *::-moz-scrollbar-thumb {
background: #888;
}

/* CodeEditor.css */

.code-editor {
@apply flex h-screen items-center justify-center;
}

.code-editor-textarea {
@apply w-full h-full bg-gray-100 p-4 text-base font-mono border border-gray-300 resize-none;
}
}

0 comments on commit 35808f9

Please sign in to comment.