commandlinewebsite/src/commandline/CommandLineManager.jsx
JuliusHerrmann 9b58955389 lower delay
2022-02-25 23:21:01 +01:00

31 lines
733 B
JavaScript

import "./CommandLineManager.css";
import {useEffect, useState} from 'react';
import CommandLineEntry from './CommandLineEntry.jsx';
import Prompt from './Prompt.jsx';
function CommandLineManager(props) {
// set the path to the correct md file via props
const path = require(`./content/${ props.page }.md`);
const [text, updateText] = useState("");
fetch(path).then(r => {
return r.text();
}).then(text => {
updateText(text);
});
const getDelay = () => {
return (text.length / Math.round(1 + (Number)(text.length / 1000)));
}
return(
<div id="commandLineManager">
<CommandLineEntry text={text}/>
<Prompt delay={getDelay()}/>
</div>
);
}
export default CommandLineManager;