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 PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import React from 'react';
|
||||
|
||||
import ns from './ns.json';
|
||||
import { isJSEnabledSelector } from './redux';
|
||||
import {Alert} from 'react-bootstrap';
|
||||
|
||||
|
||||
const mainId = 'fcc-main-frame';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isJSEnabled: isJSEnabledSelector(state)
|
||||
});
|
||||
const mapDispatchToProps = null;
|
||||
const propTypes = {
|
||||
isJSEnabled: PropTypes.bool
|
||||
const Preview = () => {
|
||||
return (
|
||||
<div className={ `${ns}-preview` }>
|
||||
<iframe
|
||||
className={ `${ns}-preview-frame` }
|
||||
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';
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(Preview);
|
||||
export default Preview;
|
||||
|
@ -186,14 +186,6 @@
|
||||
.max-element-height();
|
||||
width: 100%;
|
||||
overflow-y: hidden;
|
||||
|
||||
.js-alert-wrapper {
|
||||
.max-element-height();
|
||||
z-index: 5;
|
||||
position: fixed;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.@{ns}-preview-frame {
|
||||
|
Reference in New Issue
Block a user