feat(settings): Expand Settings page functionality (#16664)
* fix(layout): Fix Settings layout in firefox * chore(availableForHire): Remove available for hire setting * feat(helpers): Use helper components for Settings layout * fix(map): Fix undefined lang requested * feat(settings): Expand Settings page functionality * chore(pledge): Remove pledge from Settings * fix(about): Adjust AboutSettings layout * fix(portfolio): Improve PortfolioSettings layout * fix(email): Improve EmailSettings layout * fix(settings): Align save buttons with form fields * fix(AHP): Format AHP * fix(DangerZone): Adjust DangerZone layout * fix(projectSettings): Change Button Copy * fix(CertSettings): Fix certificate claim logic * chore(lint): Lint
This commit is contained in:
committed by
Quincy Larson
parent
9f034f4f79
commit
24ef69cf7a
53
common/app/routes/Settings/components/SolutionViewer.jsx
Normal file
53
common/app/routes/Settings/components/SolutionViewer.jsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Panel } from 'react-bootstrap';
|
||||
import Prism from 'prismjs';
|
||||
import Helmet from 'react-helmet';
|
||||
|
||||
const prismLang = {
|
||||
css: 'css',
|
||||
js: 'javascript',
|
||||
jsx: 'javascript',
|
||||
html: 'markup'
|
||||
};
|
||||
|
||||
function SolutionViewer({ files }) {
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
<link href='/css/prism.css' rel='stylesheet' />
|
||||
</Helmet>
|
||||
{
|
||||
Object.keys(files)
|
||||
.map(key => files[key])
|
||||
.map(file => (
|
||||
<Panel
|
||||
bsStyle='primary'
|
||||
className='solution-viewer'
|
||||
header={ file.ext.toUpperCase() }
|
||||
key={ file.ext }
|
||||
>
|
||||
<pre>
|
||||
<code
|
||||
className={ `language-${prismLang[file.ext]}` }
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: Prism.highlight(
|
||||
file.contents.trim(),
|
||||
Prism.languages[prismLang[file.ext]]
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</pre>
|
||||
</Panel>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
SolutionViewer.displayName = 'SolutionViewer';
|
||||
SolutionViewer.propTypes = {
|
||||
files: PropTypes.object
|
||||
};
|
||||
|
||||
export default SolutionViewer;
|
Reference in New Issue
Block a user