forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove flash saying JS is disabled
- Loading branch information
Showing
2 changed files
with
11 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters