2018-04-08 21:04:30 +01:00
|
|
|
import React, { Fragment } from 'react';
|
2018-04-06 14:51:52 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2018-04-08 21:04:30 +01:00
|
|
|
import MonacoEditor from 'react-monaco-editor';
|
2018-04-06 14:51:52 +01:00
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
defaultOutput: PropTypes.string,
|
|
|
|
output: PropTypes.string
|
|
|
|
};
|
|
|
|
|
2018-04-08 21:04:30 +01:00
|
|
|
const options = {
|
|
|
|
lineNumbers: false,
|
|
|
|
minimap: {
|
|
|
|
enabled: false
|
|
|
|
},
|
|
|
|
readOnly: true,
|
|
|
|
scrollbar: {
|
|
|
|
vertical: 'hidden',
|
|
|
|
horizontal: 'hidden'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-04-06 14:51:52 +01:00
|
|
|
function Output({ output, defaultOutput }) {
|
|
|
|
return (
|
2018-04-08 21:04:30 +01:00
|
|
|
<Fragment>
|
|
|
|
<base href='/' />
|
|
|
|
<MonacoEditor
|
|
|
|
className='challenge-output'
|
|
|
|
height={150}
|
|
|
|
options={options}
|
|
|
|
value={output ? output : defaultOutput}
|
|
|
|
/>
|
|
|
|
</Fragment>
|
2018-04-06 14:51:52 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Output.displayName = 'Output';
|
|
|
|
Output.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default Output;
|