1
- import React , { useEffect , useState } from "react" ;
1
+ import React , { useState , useEffect } from "react" ;
2
2
import Layout from "@theme/Layout" ;
3
-
3
+ import "./index.css" ;
4
+ import BasicEditor from "./BasicEditor" ;
5
+ const html = "/icons/html-5.svg"
6
+ const css = "/icons/css.svg"
7
+ const Js = "/icons/js.svg"
8
+ const react = "/icons/jsx.svg"
4
9
export default function LiveEditor ( ) {
10
+ const [ state , setState ] = useState ( "none" )
5
11
const [ Theme , setNewTheme ] = useState ( "dark" )
6
12
7
13
useEffect ( ( ) => {
@@ -42,8 +48,34 @@ export default function LiveEditor() {
42
48
alignItems : "center"
43
49
} }
44
50
>
45
- < iframe
46
- src = { `https://codesandbox.io/embed/github/Ajay-Dhangar/my-react-app/main?fontsize=14&hidenavigation=1&theme=${ Theme === "dark" ?"dark" :"light" } ` }
51
+ { state === "none" ?
52
+ < div className = "editor_select_container" >
53
+ < div className = "editor_container" onClick = { ( ) => setState ( "basic" ) } >
54
+ < h2 className = "editor_selcet_text" > HTML CSS JS Editor</ h2 >
55
+ < div className = "editor_select_imgage_container" >
56
+ < img src = { html } alt = "html" className = "editor_select_image" />
57
+ < h2 > HTML</ h2 >
58
+ </ div >
59
+ < div className = "editor_select_imgage_container" >
60
+ < img src = { css } alt = "css" className = "editor_select_image" />
61
+ < h2 > CSS</ h2 >
62
+ </ div >
63
+ < div className = "editor_select_imgage_container" >
64
+ < img src = { Js } alt = "js" className = "editor_select_image" />
65
+ < h2 > JavaScript</ h2 >
66
+ </ div >
67
+ </ div >
68
+ < div className = "editor_container" onClick = { ( ) => setState ( "advance" ) } >
69
+ < h2 className = "editor_selcet_text" > React.Js Editor</ h2 >
70
+ < div className = "editor_select_imgage_container" >
71
+ < img src = { react } alt = "react" className = "editor_select_image" />
72
+ < h2 > React.JS</ h2 >
73
+ </ div >
74
+ </ div >
75
+ </ div >
76
+ :state === "advance" ?
77
+ < iframe
78
+ src = { `https://codesandbox.io/embed/github/Ajay-Dhangar/my-react-app/main?fontsize=14&hidenavigation=1&theme=${ Theme === "dark" ?"dark" :"light" } ` }
47
79
style = { {
48
80
width : "100%" ,
49
81
height : "600px" ,
@@ -57,8 +89,9 @@ export default function LiveEditor() {
57
89
title = "dazzling-swanson-wne32"
58
90
allow = "accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
59
91
sandbox = "allow-autoplay allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
60
- />
92
+ /> :< BasicEditor />
93
+ }
61
94
</ div >
62
95
</ Layout >
63
96
) ;
64
- }
97
+ }
0 commit comments