Skip to content

Commit 786f566

Browse files
committed
Conflicts
2 parents 17e1c42 + 6683844 commit 786f566

File tree

6 files changed

+158
-9
lines changed

6 files changed

+158
-9
lines changed

config-overrides.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
2+
3+
module.exports = function override(config, env) {
4+
config.plugins.push(new MonacoWebpackPlugin());
5+
return config;
6+
};

package-lock.json

+92-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99
"@testing-library/react": "^11.2.5",
1010
"@testing-library/user-event": "^12.8.3",
1111
"axios": "^0.21.1",
12+
"monaco-editor-webpack-plugin": "^3.0.1",
1213
"react": "^17.0.1",
14+
"react-app-rewired": "^2.1.8",
1315
"react-dom": "^17.0.1",
16+
"react-monaco-editor": "^0.43.0",
1417
"react-router-dom": "^5.2.0",
1518
"react-scripts": "4.0.3",
1619
"web-vitals": "^1.1.1"
1720
},
1821
"scripts": {
19-
"start": "react-scripts start",
20-
"build": "react-scripts build",
21-
"test": "react-scripts test",
22-
"eject": "react-scripts eject"
22+
"start": "react-app-rewired start",
23+
"build": "react-app-rewired build",
24+
"test": "react-app-rewired test",
25+
"eject": "react-app-rewired eject"
2326
},
2427
"eslintConfig": {
2528
"extends": [

src/App.js

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import LandingPage from "./pages/Landing/LandingPage";
55
import LoginPage from "./pages/LoginPage/LoginPage";
66
import { createMuiTheme, ThemeProvider } from "@material-ui/core";
77
import SignupPage from "./pages/SignupPage/SignupPage";
8+
import Recording from "./pages/Recording/Recording";
89

910
const theme = createMuiTheme({
1011
typography: {
@@ -44,6 +45,7 @@ function App() {
4445
<Route exact path="/" component={LandingPage} />
4546
<Route exact path="/login" component={LoginPage} />
4647
<Route exact path="/register" component={SignupPage} />
48+
<Route exact path="/editor" component={Recording} />
4749
</Switch>
4850
</Router>
4951
</ThemeProvider>

src/pages/Recording/Recording.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* .recording-editor-section {
2+
min-height: 100vh;
3+
} */

src/pages/Recording/Recording.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Grid } from "@material-ui/core";
2+
import React, { useEffect, useState } from "react";
3+
import MonacoEditor from "react-monaco-editor";
4+
import "./Recording.css";
5+
6+
const Recording = () => {
7+
const [code, setCode] = useState("");
8+
const [srcDoc, setSrcDoc] = useState("");
9+
10+
useEffect(() => {
11+
const timeout = setTimeout(() => {
12+
setSrcDoc(code);
13+
}, 250);
14+
15+
return () => clearTimeout(timeout);
16+
}, [code]);
17+
18+
return (
19+
<div className="recording-editor-section">
20+
<Grid container spacing={0}>
21+
<Grid item md={6}>
22+
<MonacoEditor
23+
width="100%"
24+
height="100vh"
25+
language="html"
26+
theme="vs-dark"
27+
options={{
28+
selectOnLineNumbers: true,
29+
}}
30+
value={code}
31+
onChange={(value) => setCode(value)}
32+
/>
33+
</Grid>
34+
<Grid item md={6}>
35+
<iframe
36+
srcDoc={srcDoc}
37+
title="Preview"
38+
width="100%"
39+
height="100%"
40+
style={{ background: "white" }}
41+
/>
42+
</Grid>
43+
</Grid>
44+
</div>
45+
);
46+
};
47+
48+
export default Recording;

0 commit comments

Comments
 (0)