Files
freeCodeCamp/packages/learn/src/templates/Challenges/views/components/Output.js

40 lines
744 B
JavaScript
Raw Normal View History

import React, { Fragment } from 'react';
2018-04-06 14:51:52 +01:00
import PropTypes from 'prop-types';
import MonacoEditor from 'react-monaco-editor';
2018-04-06 14:51:52 +01:00
const propTypes = {
defaultOutput: PropTypes.string,
output: PropTypes.string
};
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 (
<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;