Add Modal
This commit is contained in:
@@ -4,7 +4,15 @@ import REPLHistory from "./REPLHistory";
|
||||
import styles from "../../styles/REPL/REPLComplete.module.css";
|
||||
import type { NextPage } from "next";
|
||||
|
||||
const REPL: NextPage<{inputRef: MutableRefObject<HTMLInputElement|undefined>}> = ({ inputRef }) => {
|
||||
interface IREPLProps {
|
||||
inputRef: MutableRefObject<HTMLInputElement|undefined>;
|
||||
modalManipulation: {
|
||||
setModalVisible: CallableFunction;
|
||||
setModalProject: CallableFunction;
|
||||
}
|
||||
}
|
||||
|
||||
const REPL: NextPage<IREPLProps> = ({ inputRef, modalManipulation }) => {
|
||||
const [history, manipulateHistory] = useState<string[]>([]);
|
||||
const onCommandExecuted = (result: string[]) => manipulateHistory(result.reverse().concat(history).slice(0, 1000));
|
||||
const onClearHistory = () => manipulateHistory([]);
|
||||
@@ -15,7 +23,7 @@ const REPL: NextPage<{inputRef: MutableRefObject<HTMLInputElement|undefined>}> =
|
||||
|
||||
return (<div className={styles.container}>
|
||||
<REPLHistory history={history} inputRef={inputRef} />
|
||||
<REPLInput historyCallback={onCommandExecuted} historyClear={onClearHistory} inputRef={inputRef} />
|
||||
<REPLInput historyCallback={onCommandExecuted} historyClear={onClearHistory} inputRef={inputRef} modalManipulation={modalManipulation} />
|
||||
<div style={{flexGrow: 2}} onClick={focusInput}></div>
|
||||
</div>);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user