2021-12-16 00:21:14 +01:00
|
|
|
import { NextPage } from "next";
|
2021-12-16 01:15:43 +01:00
|
|
|
import { MutableRefObject } from "react";
|
2021-12-16 00:21:14 +01:00
|
|
|
import styles from "../../styles/REPL/REPLHistory.module.css";
|
|
|
|
|
2021-12-16 01:15:43 +01:00
|
|
|
interface REPLHistoryParams {
|
|
|
|
history: string[];
|
|
|
|
inputRef: MutableRefObject<HTMLInputElement|undefined>;
|
|
|
|
}
|
|
|
|
|
|
|
|
const REPLHistory: NextPage<REPLHistoryParams> = ({history, inputRef}) => {
|
|
|
|
const focusInput = () => {if (inputRef.current) inputRef.current.focus();};
|
|
|
|
|
|
|
|
return <div className={styles.container} onClick={focusInput}>
|
2021-12-17 18:55:00 +01:00
|
|
|
{ history.map((value, idx) => <pre className={styles.line} key={idx}>{value === "" ? "\u00A0" : value}</pre>) }
|
2021-12-16 00:21:14 +01:00
|
|
|
</div>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default REPLHistory;
|