-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement editor and live programmable mechanism
- Loading branch information
Showing
4 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.cube-scene { | ||
/*width: 800px;*/ | ||
height: 600px; | ||
border: 1px solid black; | ||
/*margin: 20px auto;*/ | ||
} | ||
|
||
.code-editor { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.code-editor textarea { | ||
width: 90%; | ||
height: 200px; | ||
resize: none; | ||
margin-top: 10px; | ||
/*border: none;*/ | ||
/*outline: none;*/ | ||
font-size: 14px; | ||
font-family: Consolas, monospace; | ||
padding: 10px; | ||
background-color: #f8f8f8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, {useState} from "react"; | ||
|
||
|
||
const CodeEditor = ({ onExecute }) => { | ||
|
||
const [code, setCode] = useState("") | ||
|
||
const handleChange = (e) => { | ||
setCode(e.target.value); | ||
}; | ||
|
||
const handleExecute = () => { | ||
onExecute(code); | ||
}; | ||
|
||
return ( | ||
<div className="code-editor"> | ||
<textarea | ||
value={code} | ||
onChange={handleChange} | ||
/> | ||
<button onClick={handleExecute}>Execute Code</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default CodeEditor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters