@@ -6,19 +6,14 @@ import Head from '@docusaurus/Head';
66import Layout from '@theme/Layout' ;
77import HomepageFeatures from '@site/src/components/HomepageFeatures' ;
88import CodeEditor from '@site/src/components/CodeEditor2' ;
9-
10-
11-
9+ import { Box , TextField , MenuItem } from '@mui/material' ;
1210import useGeoLocation from "react-ipgeolocation" ;
13-
1411import { useColorMode } from '@docusaurus/theme-common' ;
15-
16-
17- import { EditorView } from '@codemirror/view' ;
18-
12+ import { EditorView } from '@codemirror/view' ;
1913import { Blocks } from 'react-loader-spinner'
20-
2114import useIsBrowser from '@docusaurus/useIsBrowser' ;
15+ import { ThemeProvider , createTheme } from '@mui/material/styles' ;
16+ import CssBaseline from '@mui/material/CssBaseline' ;
2217
2318
2419export const defaultLightThemeOption = EditorView . theme (
@@ -37,8 +32,9 @@ export const defaultLightThemeOption = EditorView.theme(
3732
3833
3934import styles from './index.module.css' ;
35+ import { height } from '@mui/system' ;
4036
41-
37+ //Array of Languages on right side of code editor
4238const languages = [
4339
4440 {
@@ -48,9 +44,11 @@ const languages = [
4844 name : "Urdu" ,
4945 i18nName : "اردو" ,
5046 direction : "rtl" ,
51- fontFamily : "'Kawkab Mono'" ,
47+ fontFamily : "'Roboto Mono'" ,
5248 toEnglishDict : "'languages/ur/ur_native.lang.yaml'" ,
49+ fontWeights : "bold" ,
5350 style : {
51+
5452 direction : "rtl"
5553 }
5654 } ,
@@ -61,17 +59,18 @@ const languages = [
6159 code2 : "hi" ,
6260 name : "Hindi" ,
6361 i18nName : "Hindi" ,
64- fontFamily : "'Hack', 'Courier New', monospaced" ,
62+ fontFamily : "'Roboto Mono'" ,
63+
6564 toEnglishDict : "'languages/hi/hi_native.lang.yaml'" ,
6665 } ,
6766 {
6867 id : "EN" ,
69- // default: true,
7068 code3 : "eng" ,
7169 code2 : "en" ,
7270 name : "English" ,
7371 i18nName : "English" ,
74- fontFamily : "'Hack', 'Courier New', monospaced" ,
72+ fontFamily : "'Roboto Mono'" ,
73+
7574 }
7675]
7776
@@ -126,6 +125,7 @@ const IDE = ({basicSetup, ...props}) => {
126125}
127126
128127function HomepageHeader ( ) {
128+
129129 const { siteConfig} = useDocusaurusContext ( ) ;
130130 return (
131131 < header className = { clsx ( 'hero hero--primary' , styles . heroBanner ) } >
@@ -148,7 +148,7 @@ function HomepageHeader() {
148148const initialCodes = [
149149 {
150150 id : "hello_world" ,
151- name : "Simple Hello World" ,
151+ name : " Simple Hello World" ,
152152 en : `print("Hello world!")`
153153 } ,
154154 {
@@ -185,6 +185,9 @@ with open("chad.txt", "r") as f:
185185
186186
187187export default function Home ( ) {
188+
189+
190+
188191 const { siteConfig} = useDocusaurusContext ( ) ;
189192
190193 const [ editorCode , setEditorCode ] = useState ( initialCodes [ 0 ] . en ) ;
@@ -316,6 +319,9 @@ export default function Home() {
316319
317320
318321 </ Head >
322+
323+ < MaterialThemeWrapper >
324+
319325 < HomepageHeader />
320326 < main >
321327 { /* <textarea style={{
@@ -327,67 +333,82 @@ export default function Home() {
327333 }}></textarea> */ }
328334
329335
336+ { /* *****************************************
337+ ********DIV FOR THE TOP SECTION**************
338+ ***********************************************
339+ *********************************************** */ }
330340
331- < div style = { {
332- padding : "80px"
333- } } >
334- < select style = { {
335- flex : 1 ,
336- // width: "100%",
337- margin : "12px" ,
341+ < div style = { {
342+ padding : "80px"
343+
344+ } } >
338345
339- } }
340-
341- onChange = { ( e ) => {
346+
347+
348+ < Box width = "250px" >
349+ < TextField select fullWidth label = "Choose Preset" onChange = { ( e ) => {
342350 console . log ( "e.target.value:" , e . target . value ) ;
343351 console . log ( `languages.find(l => l.id === e.target.value)` , initialCodes . find ( l => l . id === e . target . value ) )
344352 setCode ( initialCodes . find ( l => l . id === e . target . value ) . en ) ;
345353 } }
354+ style = { {
355+ marginLeft : "0.7rem"
356+ } }
346357 value = { initialCodes . find ( c => {
347358 console . log ( "c.en === code:" , c . en === code ) ;
348359 return c . en === code
349360 } ) ?. id || "custom" }
350361 key = { code }
351362 >
352- {
363+ {
353364 initialCodes . map ( ( l , idx ) => {
354365 return (
355- < option value = { l . id } > { l . name } </ option >
366+ < MenuItem value = { l . id } > { l . name } </ MenuItem >
356367 )
357368 } )
358- }
359- < option value = "custom" > Custom</ option >
360- </ select >
361- < div style = { {
362- display : "flex" ,
363- flexDirection : "row" ,
364- } } >
365- < div
369+ }
370+ < MenuItem value = "custom" > Custom</ MenuItem >
371+ </ TextField >
372+ </ Box >
373+
374+ { /* *****************************************
375+ ********DIV FOR THE LANGUAGE SECTION**********
376+ ***********************************************
377+ ************************************************/ }
378+
379+
380+ < div style = { {
381+ display : "flex" ,
382+ flexDirection : "row" ,
383+ marginTop : "12px" ,
384+ } } >
385+ < div
366386 style = { {
367387 flex : 1 ,
368388 } } >
369- < select style = { {
370- flex : 1 ,
371- // width: "100%",
372- margin : "12px" ,
373389
374- } }
375-
376- onChange = { ( e ) => {
390+ < Box width = "250px" >
391+ < TextField label = "From" fullWidth select onChange = { ( e ) => {
377392 console . log ( "e.target.value:" , e . target . value ) ;
378393 console . log ( `languages.find(l => l.id === e.target.value)` , languages . find ( l => l . id === e . target . value ) )
379394 setSourceLanguage ( languages . find ( l => l . id === e . target . value ) ) ;
380395 } }
396+ style = { {
397+ marginLeft : "0.7rem"
398+ } }
381399 value = { sourceLanguage ?. id }
382400 >
383- {
401+ {
384402 languages . map ( ( l , idx ) => {
385403 return (
386- < option value = { l . id } > { l . name } </ option >
404+ < MenuItem value = { l . id } > { l . name } </ MenuItem >
387405 )
388406 } )
389407 }
390- </ select >
408+
409+ </ TextField >
410+ </ Box >
411+
391412< IDE id = "python-code-editor1"
392413 value = { code }
393414 mode = "python"
@@ -410,45 +431,53 @@ export default function Home() {
410431 />
411432 </ div >
412433
434+ { /* IDE convertor button */ }
413435 < button style = { {
414- opacity : 0.45
436+ opacity : 0.45 ,
437+ height :"100%" ,
438+ backgroundColor : "transparent" ,
439+ border : "none" ,
440+ cursor : "pointer" ,
441+ width : "5%" ,
442+ fontSize : "1.5rem" ,
415443 } } onClick = { ( ) => {
416444 setTargetLanguage ( sourceLanguage ) ;
417445 setSourceLanguage ( targetLanguage ) ;
418446 var element = document . getElementById ( "python-code-editor2" ) ;
419447 setCode ( element . innerHTML . replaceAll ( "<br>" , "\n" ) . replaceAll ( " " , " " ) )
420448 } } >
421- ⇔
449+ { /* ⇔ */ }
450+ ⇄
422451 </ button >
423452
424- < div
453+ < div
425454 style = { {
426455 flex : 1 ,
456+ marginLeft : "12px" ,
427457 } } >
428-
429- < select style = { {
430- flex : 1 ,
431- // width: "100%",
432- margin : "12px" ,
433-
434- } }
435-
436- onChange = { ( e ) => {
458+
459+ < Box width = "250px" >
460+ < TextField select label = "To" fullWidth onChange = { ( e ) => {
437461 console . log ( "e.target.value:" , e . target . value ) ;
438462 console . log ( `languages.find(l => l.id === e.target.value)` , languages . find ( l => l . id === e . target . value ) )
439463 setTargetLanguage ( languages . find ( l => l . id === e . target . value ) ) ;
440464 setIsDetected ( false ) ;
441465 } }
466+ style = { {
467+ marginLeft : "0.7rem"
468+ } }
442469 value = { targetLanguage ?. id }
443- >
444- {
470+ >
471+ {
445472 languages . map ( ( l , idx ) => {
446473 return (
447- < option value = { l . id } > { l . name } { targetLanguage ?. id === l . id ? isDetected ? " - detected" : "" : "" } </ option >
474+ < MenuItem value = { l . id } > { l . name } { targetLanguage ?. id === l . id ? isDetected ? " - detected" : "" : "" } </ MenuItem >
448475 )
449476 } )
450477 }
451- </ select >
478+ </ TextField >
479+ </ Box >
480+
452481< IDE
453482 id = "python-code-editor2"
454483 // value={code
@@ -660,6 +689,30 @@ with open('file', 'w') as sys.stdout:
660689 </ div >
661690 { /* <HomepageFeatures /> */ }
662691 </ main >
692+ </ MaterialThemeWrapper >
693+
663694 </ Layout >
664695 ) ;
665696}
697+
698+
699+ const MaterialThemeWrapper = ( { children} ) => {
700+
701+ const { colorMode } = useColorMode ( ) ;
702+ const isDarkTheme = colorMode === "dark" ;
703+
704+ const theme = React . useMemo (
705+ ( ) =>
706+ createTheme ( {
707+ palette : {
708+ mode : isDarkTheme ? "dark" : "light" ,
709+ } ,
710+ } ) ,
711+ [ isDarkTheme ] ,
712+ ) ;
713+
714+ return < ThemeProvider theme = { theme } >
715+ < CssBaseline />
716+ { children }
717+ </ ThemeProvider >
718+ }
0 commit comments