Skip to content
This repository was archived by the owner on Apr 11, 2019. It is now read-only.

Commit c4115ff

Browse files
committed
Feat: update the application with favicon and add a selector generator
1 parent 29ef1f4 commit c4115ff

33 files changed

+94
-2
lines changed

app/src/reducers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import app from './containers/AppContainer/reducer';
1010
const rootReducer = combineReducers({
1111
app,
1212
/* GENERATOR: Compile all of your reducers */
13+
selectorTest,
1314
landing,
1415
routing: routerReducer,
1516
form: formReducer,

config/generators/container/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ module.exports = {
2929
default: true,
3030
message: 'Do you want actions/constants/reducer for this container?',
3131
},
32+
{
33+
type: 'confirm',
34+
name: 'wantSelectors',
35+
default: false,
36+
message: 'Do you want to use reselect?',
37+
},
3238
{
3339
type: 'confirm',
3440
name: 'wantGraphQL',
@@ -66,6 +72,15 @@ module.exports = {
6672
});
6773
}
6874

75+
if (data.wantSelectors) {
76+
actions.push({
77+
type: 'add',
78+
path: '../../app/src/containers/{{properCase name}}Container/selectors.js',
79+
templateFile: './container/selectors.js.hbs',
80+
abortOnFail: true,
81+
});
82+
}
83+
6984
// If they want actions and a reducer, generate actions.js, constants.js,
7085
// reducer.js and the corresponding tests for actions and the reducer
7186
if (data.wantActionsAndReducer) {

config/generators/container/index.js.hbs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import styles from './index.module.scss';
1212
import { graphql } from 'react-apollo';
1313
import gql from 'graphql-tag';
1414
{{/if}}
15+
{{#if wantSelectors}}
16+
import { createSelector } from 'reselect';
17+
import { select{{ properCase name }} } from './selectors';
18+
{{/if}}
1519

1620
class {{ properCase name }}Container extends Component { // eslint-disable-line react/prefer-stateless-function
1721
render() {
@@ -28,13 +32,20 @@ class {{ properCase name }}Container extends Component { // eslint-disable-line
2832

2933
{{ properCase name }}Container.propTypes = {
3034
// isLoading: PropTypes.bool.isRequired,
31-
}
35+
};
3236

3337
{{#if wantActionsAndReducer}}
38+
{{#if wantSelectors}}
39+
const mapStateToProps = createSelector(
40+
select{{properCase name}}(),
41+
({{camelCase name}}) => ({ {{camelCase name}} })
42+
);
43+
{{else}}
3444
// mapStateToProps :: {State} -> {Props}
3545
const mapStateToProps = (state) => ({
3646
// myProp: state.myProp,
3747
});
48+
{{/if}}
3849

3950
// mapDispatchToProps :: Dispatch -> {Action}
4051
const mapDispatchToProps = (dispatch) => ({
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createSelector } from 'reselect';
2+
3+
const select{{ properCase name }} = () => (state) => state.{{ camelCase name }};
4+
5+
export {
6+
select{{ properCase name }},
7+
};

config/templates/_index.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,28 @@
55
<meta http-equiv=X-UA-Compatible content="IE=edge">
66
<meta name="viewport" content="width=device-width,initial-scale=1">
77
<title>Scalable React Boilerplate</title>
8+
<link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-icon-57x57.png">
9+
<link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-icon-60x60.png">
10+
<link rel="apple-touch-icon" sizes="72x72" href="/favicon/apple-icon-72x72.png">
11+
<link rel="apple-touch-icon" sizes="76x76" href="/favicon/apple-icon-76x76.png">
12+
<link rel="apple-touch-icon" sizes="114x114" href="/favicon/apple-icon-114x114.png">
13+
<link rel="apple-touch-icon" sizes="120x120" href="/favicon/apple-icon-120x120.png">
14+
<link rel="apple-touch-icon" sizes="144x144" href="/favicon/apple-icon-144x144.png">
15+
<link rel="apple-touch-icon" sizes="152x152" href="/favicon/apple-icon-152x152.png">
16+
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-icon-180x180.png">
17+
<link rel="icon" type="image/png" sizes="192x192" href="/favicon/android-icon-192x192.png">
18+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
19+
<link rel="icon" type="image/png" sizes="96x96" href="/favicon/favicon-96x96.png">
20+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
21+
<link rel="manifest" href="/manifest.json">
22+
<meta name="msapplication-TileColor" content="#ffffff">
23+
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
24+
<meta name="theme-color" content="#ffffff">
825
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Raleway:400,300,700|Lato:400,300,700' rel='stylesheet' type='text/css'>
926
</head>
1027
<body>
1128
<!-- The app will bootstrap into this div -->
1229
<div id="app"></div>
13-
30+
1431
</body>
1532
</html>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"redux-form": "^5.2.5",
133133
"redux-logger": "^2.6.1",
134134
"redux-thunk": "^1.0.0",
135+
"reselect": "^2.5.4",
135136
"resolve-url-loader": "^1.4.4",
136137
"sass-loader": "^3.1.2",
137138
"style-loader": "^0.13.0",
14.3 KB
Loading
22.9 KB
Loading
2.22 KB
Loading
3.1 KB
Loading

0 commit comments

Comments
 (0)