Merge branch 'fix/remove-jsdisabled-flash' of https://github.com/tchaffee/freeCodeCamp into tchaffee-fix/remove-jsdisabled-flash
This commit is contained in:
@ -1,54 +1,20 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import ns from './ns.json';
|
import ns from './ns.json';
|
||||||
import { isJSEnabledSelector } from './redux';
|
|
||||||
import {Alert} from 'react-bootstrap';
|
|
||||||
|
|
||||||
|
|
||||||
const mainId = 'fcc-main-frame';
|
const mainId = 'fcc-main-frame';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const Preview = () => {
|
||||||
isJSEnabled: isJSEnabledSelector(state)
|
return (
|
||||||
});
|
<div className={ `${ns}-preview` }>
|
||||||
const mapDispatchToProps = null;
|
<iframe
|
||||||
const propTypes = {
|
className={ `${ns}-preview-frame` }
|
||||||
isJSEnabled: PropTypes.bool
|
id={ mainId }
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Preview extends PureComponent {
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isJSEnabled
|
|
||||||
} = this.props;
|
|
||||||
return (
|
|
||||||
<div className={ `${ns}-preview` }>
|
|
||||||
{
|
|
||||||
!isJSEnabled && (
|
|
||||||
<div className='js-alert-wrapper'>
|
|
||||||
<Alert
|
|
||||||
bsStyle='info'
|
|
||||||
className={ `${ns}-preview-js-warning` }
|
|
||||||
>
|
|
||||||
JavaScript is disabled. Execute code to enable
|
|
||||||
</Alert>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
<iframe
|
|
||||||
className={ `${ns}-preview-frame` }
|
|
||||||
id={ mainId }
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Preview.propTypes = propTypes;
|
|
||||||
Preview.displayName = 'Preview';
|
Preview.displayName = 'Preview';
|
||||||
|
|
||||||
export default connect(
|
export default Preview;
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(Preview);
|
|
||||||
|
@ -186,14 +186,6 @@
|
|||||||
.max-element-height();
|
.max-element-height();
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
|
|
||||||
.js-alert-wrapper {
|
|
||||||
.max-element-height();
|
|
||||||
z-index: 5;
|
|
||||||
position: fixed;
|
|
||||||
width: 100%
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.@{ns}-preview-frame {
|
.@{ns}-preview-frame {
|
||||||
|
Reference in New Issue
Block a user