Skip to content

Commit c768c2d

Browse files
committed
Removed Bootstrap theme and used Semantic-UI instead
1 parent 4322bb4 commit c768c2d

File tree

120 files changed

+903
-442
lines changed

Some content is hidden

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

120 files changed

+903
-442
lines changed

.bootstraprc

Lines changed: 0 additions & 79 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ webpack-stats.json
1111
webpack/dlls/*.json
1212
api/**/*.nedb
1313
*.report.html
14-
coverage
14+
coverage

package.json

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
{
2-
"name": "react-redux-universal-hot-example",
3-
"description": "Example of an isomorphic (universal) webapp using react redux and hot reloading",
4-
"author": "Kévin Berthommier <[email protected]> (http://github.com/bertho-zero)",
2+
"name": "react-redux-semantic-universal-hot-example",
3+
"description": "Example of an isomorphic (universal) webapp using react redux, semantic-ui and hot reloading",
4+
"authors": [
5+
"Kévin Berthommier <[email protected]> (https://github.com/bertho-zero)",
6+
"Dong Cai <[email protected]> (https://github.com/dongcai"
7+
],
58
"contributors": [
6-
"Erik Rasmussen <[email protected]> (http://github.com/erikras)"
9+
"Erik Rasmussen <[email protected]> (https://github.com/erikras)"
710
],
811
"license": "MIT",
912
"version": "0.9.0",
1013
"repository": {
1114
"type": "git",
12-
"url": "https://github.com/bertho-zero/react-redux-universal-hot-example"
15+
"url": "https://github.com/bertho-zero/react-redux-semantic-universal-hot-example"
1316
},
14-
"homepage": "https://github.com/bertho-zero/react-redux-universal-hot-example",
17+
"homepage": "https://github.com/bertho-zero/react-redux-semantic-usniversal-hot-example",
1518
"keywords": [
1619
"react",
1720
"isomorphic",
@@ -23,7 +26,8 @@
2326
"redux",
2427
"starter",
2528
"boilerplate",
26-
"babel"
29+
"babel",
30+
"semantic-ui"
2731
],
2832
"main": "bin/server.js",
2933
"scripts": {
@@ -36,7 +40,7 @@
3640
"watch-client": "bnr watch-client",
3741
"build": "bnr build",
3842
"build-dlls": "webpack --colors --display-error-details --config webpack/vendor.config.js",
39-
"postinstall": "concurrently \"npm run build\" \"npm run build-dlls\"",
43+
"postinstall": "concurrently \"npm run build\" \"npm run build-dlls\" \"node semantic-fix.js\"",
4044
"precommit": "lint-staged",
4145
"prettier": "prettier-eslint --write --eslint-config-path .eslintrc './+(src|api)/**/*.js'",
4246
"lint": "eslint -c .eslintrc api src",
@@ -166,13 +170,11 @@
166170
"pretty-error": "^2.0.2",
167171
"prop-types": "^15.5.8",
168172
"react": "^16.0.0",
169-
"react-bootstrap": "^0.31.2",
170173
"react-dom": "^16.0.0",
171174
"react-helmet": "^5.0.3",
172175
"react-loadable": "^5.3.0",
173176
"react-redux": "^5.0.6",
174177
"react-router": "^4.2.0",
175-
"react-router-bootstrap": "^0.24.4",
176178
"react-router-config": "^1.0.0-beta.4",
177179
"react-router-dom": "^4.2.2",
178180
"react-router-redux": "^5.0.0-alpha.6",
@@ -182,7 +184,9 @@
182184
"redux-auth-wrapper": "^2.0.2",
183185
"redux-form": "^7.1.1",
184186
"redux-logger": "^3.0.6",
185-
"redux-persist": "^5.3.4",
187+
"redux-persist": "^5.4.0",
188+
"semantic-ui-less": "^2.2.12",
189+
"semantic-ui-react": "^0.76.0",
186190
"serialize-javascript": "^1.3.0",
187191
"serve-favicon": "^2.3.2",
188192
"socket.io": "^2.0.1",
@@ -195,19 +199,17 @@
195199
"babel-loader": "^7.0.0",
196200
"babel-plugin-transform-react-jsx-source": "^6.22.0",
197201
"better-npm-run": "^0.1.0",
198-
"bootstrap-loader": "^2.1.0",
199-
"bootstrap-sass": "^3.3.7",
200202
"chai": "^4.1.1",
201203
"clean-webpack-plugin": "^0.1.15",
202-
"concurrently": "^3.3.0",
204+
"concurrently": "^3.5.1",
203205
"css-loader": "^0.28.5",
204206
"enzyme": "^3.1.0",
205207
"eslint": "^4.4.1",
206208
"eslint-config-airbnb": "^16.0.0",
207209
"eslint-loader": "^1.6.1",
208210
"eslint-plugin-import": "^2.2.0",
209211
"eslint-plugin-jsx-a11y": "^6.0.2",
210-
"eslint-plugin-react": "^7.2.1",
212+
"eslint-plugin-react": "^7.5.1",
211213
"extract-text-webpack-plugin": "^3.0.1",
212214
"file-loader": "^1.1.5",
213215
"font-awesome": "^4.7.0",
@@ -219,18 +221,18 @@
219221
"jest-cli": "^21.1.0",
220222
"less": "^3.0.0-alpha.3",
221223
"less-loader": "^4.0.3",
222-
"lighthouse": "^2.4.0",
224+
"lighthouse": "^2.6.0",
223225
"lint-staged": "^5.0.0",
224226
"mocha": "^4.0.1",
225-
"node-sass": "^4.5.0",
227+
"node-sass": "^4.7.2",
226228
"piping": "^1.0.0-rc.4",
227229
"postcss": "^6.0.9",
228230
"postcss-browser-reporter": "^0.5.0",
229231
"postcss-cssnext": "^3.0.2",
230232
"postcss-import": "^11.0.0",
231233
"postcss-loader": "^2.0.5",
232234
"postcss-reporter": "^5.0.0",
233-
"postcss-url": "^7.1.2",
235+
"postcss-url": "^7.2.1",
234236
"prettier-eslint-cli": "^4.3.2",
235237
"react-a11y": "^0.3.3",
236238
"react-addons-test-utils": "^15.4.2",

semantic-fix.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var fs = require('fs');
2+
3+
// relocate default config
4+
fs.writeFileSync(
5+
'node_modules/semantic-ui-less/theme.config',
6+
"@import '../../src/semantic/theme.config';\n",
7+
'utf8'
8+
);
9+
10+
// fix well known bug with default distribution
11+
fixFontPath('node_modules/semantic-ui-less/themes/default/globals/site.variables');
12+
fixFontPath('node_modules/semantic-ui-less/themes/flat/globals/site.variables');
13+
fixFontPath('node_modules/semantic-ui-less/themes/material/globals/site.variables');
14+
15+
function fixFontPath(filename) {
16+
var content = fs.readFileSync(filename, 'utf8');
17+
var newContent = content.replace(
18+
"@fontPath : '../../themes/",
19+
"@fontPath : '../../../themes/"
20+
);
21+
fs.writeFileSync(filename, newContent, 'utf8');
22+
}

src/client.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import routes from 'routes';
1919
import isOnline from 'utils/isOnline';
2020
import asyncMatchRoutes from 'utils/asyncMatchRoutes';
2121
import { ReduxAsyncConnect, Provider } from 'components';
22+
import './semantic/semantic.less';
2223

2324
const persistConfig = {
2425
key: 'primary',
@@ -66,9 +67,18 @@ global.socket = initSocket();
6667
});
6768

6869
const hydrate = async _routes => {
69-
const components = await asyncMatchRoutes(_routes, history.location.pathname);
70-
await trigger('fetch', components, { store, ...providers });
71-
await trigger('defer', components, { store, ...providers });
70+
const { components, match, params } = await asyncMatchRoutes(_routes, history.location.pathname);
71+
const triggerLocals = {
72+
...providers,
73+
store,
74+
match,
75+
params,
76+
history,
77+
location: history.location
78+
};
79+
await trigger('fetch', components, triggerLocals);
80+
await trigger('defer', components, triggerLocals);
81+
7282
ReactDOM.hydrate(
7383
<HotEnabler>
7484
<Provider store={store} {...providers}>

src/components/CounterButton/CounterButton.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
44
import { bindActionCreators } from 'multireducer';
55
import * as counterActions from 'redux/modules/counter';
6+
import { Button } from 'semantic-ui-react';
67

78
@connect(
89
(state, { multireducerKey: key }) => ({ count: state.counter[key].count }),
@@ -12,21 +13,19 @@ export default class CounterButton extends Component {
1213
static propTypes = {
1314
count: PropTypes.number.isRequired,
1415
increment: PropTypes.func.isRequired,
15-
className: PropTypes.string
16+
color: PropTypes.string
1617
};
1718

1819
static defaultProps = {
19-
className: ''
20+
color: ''
2021
};
2122

2223
render() {
23-
const { count, increment } = this.props;
24-
let { className } = this.props;
25-
className += ' btn btn-default';
24+
const { count, increment, color } = this.props;
2625
return (
27-
<button className={className} onClick={increment}>
26+
<Button color={color} onClick={increment}>
2827
You have clicked me {count} time{count === 1 ? '' : 's'}.
29-
</button>
28+
</Button>
3029
);
3130
}
3231
}

src/components/InfoBar/InfoBar.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
44
import { load } from 'redux/modules/info';
5+
import { Message, Button } from 'semantic-ui-react';
56

67
@connect(state => ({ info: state.info.data }), { load })
78
export default class InfoBar extends Component {
@@ -21,15 +22,11 @@ export default class InfoBar extends Component {
2122
const { info, load } = this.props; // eslint-disable-line no-shadow
2223
const styles = require('./InfoBar.scss');
2324
return (
24-
<div className={`${styles.infoBar} well`}>
25-
<div className="container">
26-
This is an info bar <strong>{info ? info.message : 'no info!'}</strong>
27-
<span className={styles.time}>{info && new Date(info.time).toString()}</span>
28-
<button className="btn btn-primary" onClick={load}>
29-
Reload from server
30-
</button>
31-
</div>
32-
</div>
25+
<Message info>
26+
This is an info bar <strong>{info ? info.message : 'no info!'}</strong>
27+
<span className={styles.time}>{info && new Date(info.time).toString()}</span>
28+
<Button onClick={load}>Reload from server</Button>
29+
</Message>
3330
);
3431
}
3532
}

0 commit comments

Comments
 (0)