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

Commit 28cb16d

Browse files
committed
Merge branch 'master' into production
2 parents 4e8677f + 7789bf5 commit 28cb16d

File tree

126 files changed

+6627
-4159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+6627
-4159
lines changed

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
"__DEVTOOLS__": true,
3737
"socket": true,
3838
"webpackIsomorphicTools": true,
39-
ga: true,
40-
Raven: true,
41-
mixpanel: true,
39+
"ga": true,
40+
"Raven": true,
41+
"mixpanel": true,
4242
"expect": true,
4343
"browser": true,
4444
"import": true,
4545
"FB": true,
4646
"window": true,
47-
sinon: true
47+
"sinon": true
4848
},
4949
"env": {
5050
"mocha": true,

LICENSE.md

Lines changed: 674 additions & 21 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ analyze-bundle-size bundle-stats.json
4444

4545
[Reactjs]: https://facebook.github.io/react/docs/getting-started.html
4646
[Redux]: http://redux.js.org/
47+
[styled-components]: http://styled-components.com
4748
[Expressjs]: http://expressjs.com/en/starter/hello-world.html
4849
[Webpack]: http://webpack.github.io/docs/what-is-webpack.html
4950
[nodejs]: https://nodejs.org/en/

bin/server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (__DEVELOPMENT__) {
3232
}
3333

3434
global.webpack_isomorphic_tools = new webpackIsomorphicTools(require('../webpack/isomorphic-tools-configuration'))
35-
.development(process.env.NODE_ENV === 'development')
36-
.server(rootDir, function() {
37-
require('../src/server.js').default();
38-
});
35+
.development(process.env.NODE_ENV === 'development')
36+
.server(rootDir, function() {
37+
require('../src/server.js').default();
38+
});

bin/server.prod.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ global.__CLIENT__ = false;
1010
global.__SERVER__ = true;
1111
global.__DEVELOPMENT__ = process.env.NODE_ENV !== 'production';
1212

13-
global.webpack_isomorphic_tools = new webpackIsomorphicTools(require('../webpack/isomorphic-tools-configuration'))
14-
.development(__DEVELOPMENT__)
15-
.server(rootDir, function() {
16-
require('../dist/server.js').default();
17-
});
13+
global.webpack_isomorphic_tools = new webpackIsomorphicTools(
14+
require('../webpack/isomorphic-tools-configuration')
15+
)
16+
.development(__DEVELOPMENT__)
17+
.server(rootDir, function() {
18+
require('../dist/server.js').default();
19+
});

karma.conf.js

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
var webpack = require('webpack');
1+
const path = require('path');
2+
const webpack = require('webpack');
23

3-
module.exports = function(config) {
4+
module.exports = config => {
45
config.set({
5-
66
// base path that will be used to resolve all patterns (eg. files, exclude)
77
basePath: '',
88

@@ -26,42 +26,42 @@ module.exports = function(config) {
2626
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
2727
'./tests/polyfill/Event.js',
2828
'./node_modules/Intl/locale-data/jsonp/en-US.js',
29-
{pattern: 'static/images/*', watched: false, included: false, served: true},
29+
{
30+
pattern: 'static/images/*',
31+
watched: false,
32+
included: false,
33+
served: true
34+
},
3035

3136
// Actual tests here
3237
'tests.webpack.js'
3338
],
3439

3540
// list of files to exclude
36-
exclude: [
37-
],
41+
exclude: [],
3842

3943
proxies: {
40-
'/images': __dirname + '/static/images',
41-
'/images/': __dirname + '/static/images/',
44+
'/images': path.join(__dirname, '/static/images'),
45+
'/images/': path.join(__dirname, '/static/images/')
4246
},
4347

4448
proxyValidateSSL: false,
4549

4650
// preprocess matching files before serving them to the browser
4751
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessors
48-
4952
preprocessors: {
50-
'tests.webpack.js': [ 'webpack', 'sourcemap' ]
53+
'tests.webpack.js': ['webpack', 'sourcemap']
5154
},
5255

5356
webpack: {
5457
externals: {
55-
'cheerio': 'window',
58+
cheerio: 'window',
5659
'react/addons': true,
5760
'react/lib/ExecutionEnvironment': true,
5861
'react/lib/ReactContext': true
5962
},
6063
resolve: {
61-
modules: [
62-
'src',
63-
'node_modules'
64-
],
64+
modules: ['src', 'node_modules'],
6565
extensions: ['', '.json', '.js']
6666
},
6767

@@ -72,9 +72,16 @@ module.exports = function(config) {
7272
exclude: [/server/, /node_modules/, /tests/],
7373
loader: 'babel'
7474
},
75-
{ test: /\.json$/, loader: 'json-loader'},
76-
{ test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap' },
77-
{ test: /\.(jpe?g|png|gif|svg)$/, loader: 'url', query: {limit: 10240} }
75+
{ test: /\.json$/, loader: 'json-loader' },
76+
{
77+
test: /\.scss$/,
78+
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap'
79+
},
80+
{
81+
test: /\.(jpe?g|png|gif|svg)$/,
82+
loader: 'url',
83+
query: { limit: 10240 }
84+
}
7885
]
7986
},
8087

@@ -86,12 +93,12 @@ module.exports = function(config) {
8693
fs: 'empty'
8794
},
8895

89-
plugins:[
96+
plugins: [
9097
new webpack.DefinePlugin({
9198
__CLIENT__: true,
9299
__SERVER__: false,
93100
__DEVELOPMENT__: true,
94-
__DEVTOOLS__: false // <-------- DISABLE redux-devtools HERE
101+
__DEVTOOLS__: false // <-------- DISABLE redux-devtools HERE
95102
})
96103
],
97104

@@ -119,20 +126,16 @@ module.exports = function(config) {
119126
// web server port
120127
port: 9876,
121128

122-
123129
// enable / disable colors in the output (reporters and logs)
124130
colors: true,
125131

126-
127132
// level of logging
128133
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
129134
logLevel: config.LOG_INFO,
130135

131-
132136
// enable / disable watching file and executing tests whenever any file changes
133137
autoWatch: true,
134138

135-
136139
// start these browsers
137140
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
138141
// browsers: ['Chrome', 'PhantomJS'],

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"test:stylelint": "stylelint './src/**/*.scss' --config ./webpack/.stylelintrc",
1414
"dev-old": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node ./webpack/webpack-dev-server.js & env NODE_PATH='./src' PORT=8000 node ./bin/server.js",
1515
"dev": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node --expose-gc ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config ./webpack/dev.config.js --progress & env NODE_PATH='./src' PORT=8000 node --expose-gc ./bin/server.js",
16-
"start": "NODE_PATH='src' node ./start",
1716
"build": "npm run build:client & npm run build:server",
1817
"build:server": "babel ./src -d ./dist -D",
1918
"build:client": "webpack --config ./webpack/prod.config.js",
@@ -33,6 +32,10 @@
3332
"npm run prettier",
3433
"npm run lint:fix",
3534
"git add"
35+
],
36+
"*.scss": [
37+
"npm run prettier",
38+
"git add"
3639
]
3740
},
3841
"engines": {
@@ -104,7 +107,7 @@
104107
"promise": "7.1.1",
105108
"proxy-middleware": "0.14.0",
106109
"qs": "6.2.1",
107-
"quran-components": "^0.0.73",
110+
"quran-components": "^0.0.78",
108111
"raven": "1.1.1",
109112
"raw-loader": "0.5.1",
110113
"react": "15.4.1",
@@ -139,6 +142,7 @@
139142
"sitemap": "1.8.1",
140143
"strip-loader": "0.1.2",
141144
"style-loader": "0.13.1",
145+
"styled-components": "^2.1.0",
142146
"superagent": "3.3.1",
143147
"url": "0.11.0",
144148
"url-loader": "0.5.7",
@@ -184,7 +188,7 @@
184188
"phantomjs-polyfill": "0.0.1",
185189
"piping": "0.3.0",
186190
"pre-commit": "1.1.3",
187-
"prettier": "^1.2.2",
191+
"prettier": "^1.5.2",
188192
"react-addons-test-utils": "15.4.1",
189193
"react-transform-catch-errors": "1.0.0",
190194
"react-transform-hmr": "1.0.1",

src/client.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import useScroll from 'react-router-scroll';
1010
import { ReduxAsyncConnect } from 'redux-connect';
1111
import { syncHistoryWithStore } from 'react-router-redux';
1212
import { AppContainer } from 'react-hot-loader';
13+
import { ThemeProvider } from 'styled-components';
1314

1415
import debug from 'debug';
1516

1617
import config from './config';
18+
import theme from './theme';
1719
import ApiClient from './helpers/ApiClient';
1820
import createStore from './redux/create';
1921
import routes from './routes';
@@ -47,16 +49,18 @@ match(
4749
{ history, routes: routes(store) },
4850
(error, redirectLocation, renderProps) => {
4951
const component = (
50-
<Router
51-
{...renderProps}
52-
render={props => (
53-
<ReduxAsyncConnect
54-
{...props}
55-
helpers={{ client }}
56-
render={applyRouterMiddleware(useScroll())}
57-
/>
58-
)}
59-
/>
52+
<ThemeProvider theme={theme}>
53+
<Router
54+
{...renderProps}
55+
render={props => (
56+
<ReduxAsyncConnect
57+
{...props}
58+
helpers={{ client }}
59+
render={applyRouterMiddleware(useScroll())}
60+
/>
61+
)}
62+
/>
63+
</ThemeProvider>
6064
);
6165

6266
const mountNode = document.getElementById('app');

src/components/Audioplayer/ScrollButton/index.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
import React, { PropTypes } from 'react';
2+
import styled from 'styled-components';
23
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
34
import Tooltip from 'react-bootstrap/lib/Tooltip';
45
import LocaleFormattedMessage from 'components/LocaleFormattedMessage';
56

6-
const style = require('../style.scss');
7+
const ScrollLink = styled.a`
8+
width: 100%;
9+
display: inline-block;
10+
cursor: pointer;
11+
padding-right: 1.5%;
12+
color: ${props => (props.active ? props.theme.brandPrimary : props.theme.textColor)};
13+
outline: none;
14+
cursor: pointer;
15+
margin-bottom: 0;
16+
`;
717

818
const ScrollButton = ({ shouldScroll, onScrollToggle }) => {
919
const tooltip = (
@@ -22,14 +32,13 @@ const ScrollButton = ({ shouldScroll, onScrollToggle }) => {
2232
placement="top"
2333
trigger={['hover', 'focus']}
2434
>
25-
<a
35+
<ScrollLink
2636
tabIndex="-1"
27-
className={`pointer ${style.buttons} ${shouldScroll ? style.scroll : ''}`}
37+
active={shouldScroll}
2838
onClick={onScrollToggle}
29-
style={{ marginBottom: 0 }}
3039
>
3140
<i className="ss-icon ss-link" />
32-
</a>
41+
</ScrollLink>
3342
</OverlayTrigger>
3443
</div>
3544
);
Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
11
/* eslint-disable jsx-a11y/no-static-element-interactions */
22
import React, { Component, PropTypes } from 'react';
3+
import styled from 'styled-components';
34

4-
const styles = require('./style.scss');
5+
const Container = styled.div`
6+
height: 6px;
7+
width: 100%;
8+
background-color: #f7f7f7;
9+
cursor: pointer;
10+
margin-bottom: 5px;
11+
`;
12+
13+
const Progress = styled.div`
14+
height: 100%;
15+
background-color: ${props => props.theme.brandPrimary};
16+
position: relative;
17+
padding-left: 12px;
18+
19+
20+
&:after{
21+
content: '';
22+
height: 12px;
23+
width: 12px;
24+
border-radius: 10px;
25+
position: absolute;
26+
right: 0;
27+
display: block;
28+
background: #fff;
29+
top: -3px;
30+
box-shadow: 0 1px 2px rgba(0,0,0,0.45);
31+
transition: height 0.5s;
32+
}
33+
`;
534

635
export default class Track extends Component {
736
static propTypes = {
@@ -12,10 +41,8 @@ export default class Track extends Component {
1241
handleClick = (event) => {
1342
const { onTrackChange } = this.props;
1443

15-
const fraction = (
16-
event.nativeEvent.offsetX /
17-
this.container.getBoundingClientRect().width
18-
);
44+
const fraction =
45+
event.nativeEvent.offsetX / this.container.getBoundingClientRect().width;
1946

2047
return onTrackChange(fraction);
2148
};
@@ -24,13 +51,14 @@ export default class Track extends Component {
2451
const { progress } = this.props;
2552

2653
return (
27-
<div
28-
ref={(container) => { this.container = container; }}
29-
className={styles.container}
54+
<Container
55+
ref={(container) => {
56+
this.container = container;
57+
}}
3058
onClick={this.handleClick}
3159
>
32-
<div className={styles.progress} style={{ width: `${progress}%` }} />
33-
</div>
60+
<Progress style={{ width: `${progress}%` }} />
61+
</Container>
3462
);
3563
}
3664
}

0 commit comments

Comments
 (0)