Skip to content

Commit

Permalink
fix: remove flash saying JS is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaffee committed Mar 23, 2018
1 parent 1d51322 commit 3a191fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 53 deletions.
56 changes: 11 additions & 45 deletions common/app/routes/Challenges/Preview.jsx
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;
8 changes: 0 additions & 8 deletions common/app/routes/Challenges/challenges.less
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3a191fc

Please sign in to comment.