Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Local support #523

Merged
merged 21 commits into from
Dec 25, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/NoScript/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import ReactDOM from 'react-dom/server';

export default function NoScript(props) {
const staticMarkup = ReactDOM.renderToStaticMarkup(props.children);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just

return <noscript>{props.children}</noscript>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmahalwy I took this code from this comment: facebook/react#1252 (comment)

Honestly don't know yet what's difference b/w these two approaches :)

return <noscript dangerouslySetInnerHTML={{__html: staticMarkup}} />;
}
23 changes: 0 additions & 23 deletions src/components/NoScriptWarning/index.js

This file was deleted.

16 changes: 14 additions & 2 deletions src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { asyncConnect } from 'redux-connect';
import Helmet from 'react-helmet';
import Modal from 'react-bootstrap/lib/Modal';
import SmartBanner from 'components/SmartBanner';
import Link from 'react-router/lib/Link';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';

const ModalHeader = Modal.Header;
const ModalTitle = Modal.Title;
Expand All @@ -16,7 +19,7 @@ import config from 'config';
import metricsConfig from 'helpers/metrics';
import { authConnect } from './connect';
import Footer from 'components/Footer';
import NoScriptWarning from 'components/NoScriptWarning';
import NoScript from 'components/NoScript';

import FontStyles from 'components/FontStyles';

Expand All @@ -42,7 +45,16 @@ class App extends Component {
<div>
<Helmet {...config.app.head} />
<FontStyles />
<NoScriptWarning />
<NoScript>
<Row className='noscript-warning'>
<Col md={12}>
<p> Looks like either your browser does not support Javascript or its disabled. Quran.com workes best with JavaScript enabled.
For more instruction on how to enable javascript
<Link to="http://www.enable-javascript.com/"> Click here </Link>
</p>
</Col>
</Row>
</NoScript>
{children}
<SmartBanner title="The Noble Quran - القرآن الكريم" button="Install"/>
<Footer />
Expand Down
2 changes: 1 addition & 1 deletion src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
@import 'partials/tooltip';
@import 'partials/highlight';
@import 'partials/local-switcher';

@import 'nightmode';
@import 'partials/noscript-message';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we want to move more into the css-modules way of doing it and less of global css styles. So, if you have const styles = require('style.scss'); and use that style in the javascript file, it'd solve that. Similar to how we have it in other files/components


html,body{
height: 100%;
Expand Down
11 changes: 11 additions & 0 deletions src/styles/partials/_noscript-message.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.noscript-message {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1201;
text-align: center;
color: #FFF;
background-color: #AE0000;
padding: 5px 0 5px 0;
}