homepage.js/react/resume/src/Base.js

71 lines
2.2 KiB
JavaScript
Raw Normal View History

2023-03-09 15:57:46 +01:00
import React, { Component } from 'react';
import Terminal from 'react-console-emulator';
import Files from './emulation/files';
import commands from './emulation/commands';
2023-03-09 16:50:22 +01:00
import Colored from './helpers/color';
2023-03-09 15:57:46 +01:00
2023-03-10 08:05:46 +01:00
import './font/sourcecode.css';
2023-03-10 02:01:20 +01:00
2023-03-09 16:50:22 +01:00
const welcome = <pre>
Welcome to my resume!<br/>
Type
<Colored color='#156ea4'> help </Colored>
for a list of commands.
</pre>;
2023-03-09 15:57:46 +01:00
2023-03-09 16:27:10 +01:00
const inputStyle = { color: '#2e8b7e', fontWeight: 'bold' };
2023-03-09 15:57:46 +01:00
export class Base extends Component {
2023-03-09 16:50:22 +01:00
constructor(props) {
super(props);
this.terminal = React.createRef();
}
2023-03-09 15:57:46 +01:00
render() {
return (
<Terminal
2023-03-09 16:50:22 +01:00
ref={this.terminal}
commands={commands(this.terminal)}
2023-03-09 15:57:46 +01:00
welcomeMessage={welcome}
2023-03-09 16:27:10 +01:00
promptLabel={
/*
<table className='prompt_table'>
<tbody>
<tr>
<td style={inputStyle}>user@blek.codes</td>
<td className='prompt_spacing'></td>
<td style={{color: '#2968ac'}}> ~/resume </td>
<td className='prompt_spacing'></td>
<td style={{color: '#ff5092'}}>(</td>
<td className='prompt_spacing'></td>
<td style={{color:'limegreen'}}>master</td>
<td className='prompt_spacing'></td>
<td style={{color: '#ff5092'}}>)</td>
<td className='prompt_spacing'></td>
<td>$</td>
</tr>
</tbody>
</table>
*/
'$ '
2023-03-09 16:27:10 +01:00
}
2023-03-09 16:50:22 +01:00
errorText={'zsh: command not found: [command]'}
2023-03-09 16:27:10 +01:00
2023-03-10 08:05:46 +01:00
className='console'
2023-03-09 16:27:10 +01:00
promptLabelStyle={inputStyle}
inputTextStyle={{...inputStyle, color: '#5ba2b0', transform: 'translate(2px, 2px)'}}
2023-03-09 16:27:10 +01:00
styleEchoBack={'fullInherit'}
2023-03-09 16:50:22 +01:00
noDefaults
2023-03-09 15:57:46 +01:00
/>
)
}
2023-03-10 08:21:34 +01:00
componentDidMount() {
this.terminal.current.focusTerminal();
}
2023-03-09 15:19:09 +01:00
}