Skip to content

Commit 4e37a05

Browse files
Fix fonts and added MUI
1 parent 86b86fc commit 4e37a05

File tree

6 files changed

+378
-35
lines changed

6 files changed

+378
-35
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"@codemirror/lang-python": "^6.1.1",
1818
"@docusaurus/core": "2.2.0",
1919
"@docusaurus/preset-classic": "2.2.0",
20+
"@emotion/react": "^11.10.6",
21+
"@emotion/styled": "^11.10.6",
2022
"@mdx-js/react": "^1.6.22",
23+
"@mui/material": "^5.11.10",
2124
"@uiw/codemirror-extensions-langs": "^4.19.4",
2225
"@uiw/codemirror-themes": "^4.19.4",
2326
"@uiw/react-codemirror": "^4.19.4",

src/components/CodeEditor/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class CodeEditor extends React.PureComponent {
3737
const { value } = this.state;
3838

3939
return (
40+
4041
<AceEditor
4142
// theme="twilight"
4243
theme="github"

src/css/custom.css

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,16 @@
44
* work well for content-centric websites.
55
*/
66

7-
@font-face {
8-
font-family: 'Kawkab Mono';
9-
src: url(/static/KawkabMono-Regular.ttf) format('truetype');
10-
}
117

12-
@font-face {
13-
font-family: 'Kawkab Mono';
14-
font-weight: 200;
15-
src: url(/static/KawkabMono-Light.ttf) format('truetype');
16-
}
178

18-
@font-face {
19-
font-family: 'Kawkab Mono';
20-
font-weight: 900;
21-
src: url(/static/KawkabMono-Bold.ttf) format('truetype');
22-
}
239

10+
11+
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&display=swap');
2412
/* You can override the default Infima variables here. */
2513
:root {
26-
/* --ifm-font-family-monospace: "Kawkab Mono Regular"; */
14+
/* --ifm-font-family-base: "Roboto Mono"; */
15+
/* --ifm-font-family-mono: "Robot Mono"; */
16+
/* --ifm-font-family-mono: "Roboto Mono"; */
2717
--ifm-color-primary: #2e8555;
2818
--ifm-color-primary-dark: #29784c;
2919
--ifm-color-primary-darker: #277148;
@@ -33,6 +23,8 @@
3323
--ifm-color-primary-lightest: #3cad6e;
3424
--ifm-code-font-size: 95%;
3525
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
26+
27+
3628
}
3729

3830
/* For readability concerns, you should choose a lighter palette in dark mode. */
@@ -45,5 +37,6 @@
4537
--ifm-color-primary-lighter: #32d8b4;
4638
--ifm-color-primary-lightest: #4fddbf;
4739
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
40+
4841
}
4942

src/pages/index.js

Lines changed: 107 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import Head from '@docusaurus/Head';
66
import Layout from '@theme/Layout';
77
import HomepageFeatures from '@site/src/components/HomepageFeatures';
88
import CodeEditor from '@site/src/components/CodeEditor2';
9+
import { Box,TextField,MenuItem } from '@mui/material';
10+
import Select, { SelectChangeEvent } from '@mui/material/Select'
11+
12+
913

1014

1115

@@ -37,6 +41,7 @@ export const defaultLightThemeOption = EditorView.theme(
3741

3842

3943
import styles from './index.module.css';
44+
import { height } from '@mui/system';
4045

4146

4247
const languages = [
@@ -48,9 +53,10 @@ const languages = [
4853
name: "Urdu",
4954
i18nName: "اردو",
5055
direction: "rtl",
51-
fontFamily: "'Kawkab Mono'",
56+
fontFamily: "'Roboto Mono'",
5257
toEnglishDict: "'languages/ur/ur_native.lang.yaml'",
5358
style: {
59+
fontWeight: "bold",
5460
direction: "rtl"
5561
}
5662
},
@@ -126,6 +132,7 @@ const IDE = ({basicSetup, ...props}) => {
126132
}
127133

128134
function HomepageHeader() {
135+
129136
const {siteConfig} = useDocusaurusContext();
130137
return (
131138
<header className={clsx('hero hero--primary', styles.heroBanner)}>
@@ -148,7 +155,7 @@ function HomepageHeader() {
148155
const initialCodes = [
149156
{
150157
id: "hello_world",
151-
name: "Simple Hello World",
158+
name: " Simple Hello World",
152159
en: `print("Hello world!")`
153160
},
154161
{
@@ -327,15 +334,54 @@ export default function Home() {
327334
}}></textarea> */}
328335

329336

337+
{/* *****************************************
338+
********DIV FOR THE TOP SECTION**************
339+
***********************************************
340+
*********************************************** */}
330341

331342
<div style={{
332343
padding: "80px"
344+
333345
}}>
334-
<select style={{
346+
347+
348+
349+
<Box width="250px">
350+
<TextField select fullWidth label="Select preset" onChange={(e) => {
351+
console.log("e.target.value:", e.target.value);
352+
console.log(`languages.find(l => l.id === e.target.value)`, initialCodes.find(l => l.id === e.target.value))
353+
setCode(initialCodes.find(l => l.id === e.target.value).en);
354+
}}
355+
value={initialCodes.find(c => {
356+
console.log("c.en === code:", c.en === code);
357+
return c.en === code
358+
})?.id || "custom"}
359+
key={code}
360+
>
361+
{
362+
initialCodes.map((l, idx) => {
363+
return (
364+
<MenuItem value={l.id}>{l.name}</MenuItem>
365+
)
366+
})
367+
}
368+
<MenuItem value="custom">Custom</MenuItem>
369+
</TextField>
370+
371+
</Box>
372+
373+
374+
375+
376+
{/* <select style={{
335377
flex: 1,
336-
// width: "100%",
378+
// // width: "100%",
337379
margin: "12px",
338380
381+
382+
383+
384+
339385
}}
340386
341387
onChange={(e) => {
@@ -357,16 +403,38 @@ export default function Home() {
357403
})
358404
}
359405
<option value="custom">Custom</option>
360-
</select>
406+
</select> */}
361407
<div style={{
362408
display: "flex",
363409
flexDirection: "row",
410+
marginTop: "12px",
364411
}}>
365412
<div
366413
style={{
367414
flex: 1,
368415
}}>
369-
<select style={{
416+
417+
{/* **************************Language*********************************** */}
418+
<Box width="250px">
419+
<TextField label="Select Language"fullWidth select onChange={(e) => {
420+
console.log("e.target.value:", e.target.value);
421+
console.log(`languages.find(l => l.id === e.target.value)`, languages.find(l => l.id === e.target.value))
422+
setSourceLanguage(languages.find(l => l.id === e.target.value));
423+
}}
424+
value={sourceLanguage?.id}
425+
>
426+
{
427+
languages.map((l, idx) => {
428+
return (
429+
<MenuItem value={l.id}>{l.name}</MenuItem>
430+
)
431+
})
432+
}
433+
434+
</TextField>
435+
</Box>
436+
437+
{/* <select style={{
370438
flex: 1,
371439
// width: "100%",
372440
margin: "12px",
@@ -387,7 +455,7 @@ export default function Home() {
387455
)
388456
})
389457
}
390-
</select>
458+
</select> */}
391459
<IDE id="python-code-editor1"
392460
value={code}
393461
mode="python"
@@ -410,23 +478,51 @@ export default function Home() {
410478
/>
411479
</div>
412480

481+
{/* IDE convertor button */}
413482
<button style={{
414-
opacity: 0.45
483+
opacity: 0.45,
484+
height:"100%",
485+
backgroundColor: "transparent",
486+
border: "none",
487+
cursor: "pointer",
488+
width: "5%",
489+
fontSize: "1.5rem",
415490
}} onClick={()=>{
416491
setTargetLanguage(sourceLanguage);
417492
setSourceLanguage(targetLanguage);
418493
var element = document.getElementById("python-code-editor2");
419494
setCode(element.innerHTML.replaceAll("<br>", "\n").replaceAll("&nbsp;", " "))
420495
}}>
421-
&#8660;
496+
{/* &#8660; */}
497+
&#8644;
422498
</button>
423499

424500
<div
425501
style={{
426502
flex: 1,
503+
marginLeft: "12px",
427504
}}>
505+
506+
<Box width="250px">
507+
<TextField select label="Select Language" fullWidth onChange={(e) => {
508+
console.log("e.target.value:", e.target.value);
509+
console.log(`languages.find(l => l.id === e.target.value)`, languages.find(l => l.id === e.target.value))
510+
setTargetLanguage(languages.find(l => l.id === e.target.value));
511+
setIsDetected(false);
512+
}}
513+
value={targetLanguage?.id}
514+
>
515+
{
516+
languages.map((l, idx) => {
517+
return (
518+
<MenuItem value={l.id}>{l.name} {targetLanguage?.id === l.id ? isDetected ? " - detected" : "" : ""}</MenuItem>
519+
)
520+
})
521+
}
522+
</TextField>
523+
</Box>
428524

429-
<select style={{
525+
{/* <select style={{
430526
flex: 1,
431527
// width: "100%",
432528
margin: "12px",
@@ -448,7 +544,7 @@ export default function Home() {
448544
)
449545
})
450546
}
451-
</select>
547+
</select> */}
452548
<IDE
453549
id="python-code-editor2"
454550
// value={code

src/pages/index.module.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* CSS files with the .module.css suffix will be treated as CSS modules
33
* and scoped locally.
44
*/
5+
/* @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&display=swap'); */
56

67
.heroBanner {
78
padding: 4rem 0;
@@ -21,3 +22,8 @@
2122
align-items: center;
2223
justify-content: center;
2324
}
25+
.hero__subtitle {
26+
font-family: "Roboto Mono";
27+
font-weight: bolder;
28+
}
29+

0 commit comments

Comments
 (0)