JS is disabled alert

This commit is contained in:
Joshua Swift
2017-12-29 20:26:38 +00:00
parent ee8ac7b453
commit 23d2f2a08b

View File

@@ -0,0 +1,50 @@
import React, { PropTypes, PureComponent } from 'react';
import { connect } from 'react-redux';
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
};
export class Preview extends PureComponent {
render() {
const {
isJSEnabled
} = this.props;
return (
<div className={ `${ns}-preview` }>
{
!isJSEnabled && (
<Alert
bsStyle='info'
className={ `${ns}-preview-js-warning`}
>
JavaScript is disabled. Execute code to enable
</Alert>
)
}
<iframe
className={ `${ns}-preview-frame` }
id={ mainId }
/>
</div>
);
}
}
Preview.propTypes = propTypes;
Preview.displayName = 'Preview';
export default connect(
mapStateToProps,
mapDispatchToProps
)(Preview);