1- import React , { useEffect , useState } from "react" ;
1+ import React , { useState , useEffect } from "react" ;
22import 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"
49export default function LiveEditor ( ) {
10+ const [ state , setState ] = useState ( "none" )
511 const [ Theme , setNewTheme ] = useState ( "dark" )
612
713 useEffect ( ( ) => {
@@ -42,8 +48,34 @@ export default function LiveEditor() {
4248 alignItems : "center"
4349 } }
4450 >
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" } ` }
4779 style = { {
4880 width : "100%" ,
4981 height : "600px" ,
@@ -57,8 +89,9 @@ export default function LiveEditor() {
5789 title = "dazzling-swanson-wne32"
5890 allow = "accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
5991 sandbox = "allow-autoplay allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
60- />
92+ /> :< BasicEditor />
93+ }
6194 </ div >
6295 </ Layout >
6396 ) ;
64- }
97+ }
0 commit comments