Skip to content

Commit

Permalink
feat: Add 'Hello World' page
Browse files Browse the repository at this point in the history
  • Loading branch information
mori-dev committed Nov 30, 2016
1 parent 2636cc1 commit 4bc1e1e
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/containers/main_container.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// @flow
import React, { Component } from 'react';
import { connect } from 'react-redux';
import AppBar from 'material-ui/AppBar';

function mapStateToProps(state: Object): Object {
return {};
}

function mapDispatchToProps(dispatch: Function): Object {
return {};
}

class MainContainer extends Component {

props: {};

render() {
return (
<div>
<AppBar title={'Template App'} />
<h1>HELLO WORLD</h1>
</div>
);
}
}

export default connect(mapStateToProps, mapDispatchToProps)(MainContainer);
22 changes: 22 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import injectTapEventPlugin from 'react-tap-event-plugin';
import configureStore from './store/configure_store';
import MainContainer from './containers/main_container';

export const store = configureStore();

// https://github.com/callemall/material-ui/issues/4670
injectTapEventPlugin();

ReactDOM.render(
<Provider store={store}>
<MuiThemeProvider muiTheme={getMuiTheme()}>
<MainContainer />
</MuiThemeProvider>
</Provider>,
document.getElementById('root'),
)
8 changes: 8 additions & 0 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { routerReducer } from 'react-router-redux';
import { combineReducers } from 'redux';

const rootReducer = combineReducers({
routing: routerReducer,
});

export default rootReducer;
10 changes: 10 additions & 0 deletions src/sagas/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @flow
import 'babel-polyfill';
// import { fork } from 'redux-saga/effects';
// import { watchFoo } from './foo';

export default function* rootSaga(): Generator<any, any, any> {
yield [
// fork(watchFoo),
];
}
25 changes: 25 additions & 0 deletions src/store/configure_store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { createStore, applyMiddleware, compose } from 'redux';
import createLogger from 'redux-logger';
import createSagaMiddleware from 'redux-saga';
import { routerMiddleware } from 'react-router-redux';
import { browserHistory } from 'react-router';
import rootSaga from '../sagas/index';
import rootReducer from '../reducers';

const routing = routerMiddleware(browserHistory);
const sagaMiddleware = createSagaMiddleware();
const enhancer = compose(
applyMiddleware(
routing,
sagaMiddleware,
createLogger(),
),
);

function configureStore(initialState) {
const store = createStore(rootReducer, initialState, enhancer);
sagaMiddleware.run(rootSaga);
return store;
}

export default configureStore;
11 changes: 11 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html lang='ja'>
<head>
<meta charset="utf-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>title 欄</title>
</head>
<body style="margin: 0px; padding: 0px">
<div id="root"></div>
</body>
<script src="js/bundle.js"></script>
</html>

0 comments on commit 4bc1e1e

Please sign in to comment.