Refactor to make language selection dynamic

This commit is contained in:
Nilay Majorwar
2021-12-18 17:15:22 +05:30
parent 2322ebe55d
commit bb9e85f422
9 changed files with 172 additions and 111 deletions

26
pages/ide/brainfuck.tsx Normal file
View File

@ -0,0 +1,26 @@
import React from "react";
import { NextPage } from "next";
import Head from "next/head";
import { Mainframe } from "../../ui/Mainframe";
import { Header } from "../../ui/header";
import LangProvider from "../../engines/brainfuck";
const LANG_ID = "brainfuck";
const LANG_NAME = "Brainfuck";
const IDE: NextPage = () => {
return (
<>
<Head>
<title>{LANG_NAME} | Esolang Park</title>
</Head>
<div style={{ height: "100%", display: "flex", flexDirection: "column" }}>
<Header />
<div style={{ flexGrow: 1 }}>
<Mainframe langName={LANG_ID} provider={LangProvider} />
</div>
</div>
</>
);
};
export default IDE;

26
pages/ide/sample-lang.tsx Normal file
View File

@ -0,0 +1,26 @@
import React from "react";
import { NextPage } from "next";
import Head from "next/head";
import { Mainframe } from "../../ui/Mainframe";
import { Header } from "../../ui/header";
import LangProvider from "../../engines/sample-lang";
const LANG_ID = "sample-lang";
const LANG_NAME = "Sample";
const IDE: NextPage = () => {
return (
<>
<Head>
<title>{LANG_NAME} | Esolang Park</title>
</Head>
<div style={{ height: "100%", display: "flex", flexDirection: "column" }}>
<Header />
<div style={{ flexGrow: 1 }}>
<Mainframe langName={LANG_ID} provider={LangProvider} />
</div>
</div>
</>
);
};
export default IDE;

View File

@ -3,6 +3,7 @@ import { NextPage } from "next";
import { Mainframe } from "../ui/Mainframe";
import Head from "next/head";
import { Header } from "../ui/header";
import BrainfuckProvider from "../engines/brainfuck";
const Index: NextPage = () => {
return (
@ -13,7 +14,7 @@ const Index: NextPage = () => {
<div style={{ height: "100%", display: "flex", flexDirection: "column" }}>
<Header />
<div style={{ flexGrow: 1 }}>
<Mainframe />
<Mainframe langName="brainfuck" provider={BrainfuckProvider} />
</div>
</div>
</>