Что-то вроде hello world для фронта

This commit is contained in:
SleepWalker
2016-01-02 22:24:07 +02:00
commit eafa64d5a3
14 changed files with 610 additions and 0 deletions

15
src/index.html Normal file
View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ely.by - Account</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
</head>
<body>
<div id="app"></div>
</body>
</html>

34
src/index.js Normal file
View File

@@ -0,0 +1,34 @@
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, combineReducers } from 'redux';
import { Provider as ReduxProvider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import { syncReduxAndRouter, routeReducer } from 'redux-simple-router';
import { IntlProvider } from 'react-intl';
import reducers from 'reducers';
import routes from 'routes';
const reducer = combineReducers({
...reducers,
routing: routeReducer
});
const store = createStore(reducer);
syncReduxAndRouter(browserHistory, store);
ReactDOM.render(
<IntlProvider locale="en" messages={{}}>
<ReduxProvider store={store}>
<Router history={browserHistory}>
{routes}
</Router>
</ReduxProvider>
</IntlProvider>,
document.getElementById('app')
);

2
src/reducers.js Normal file
View File

@@ -0,0 +1,2 @@
export default {
};

45
src/routes.js Normal file
View File

@@ -0,0 +1,45 @@
import React from 'react';
import { Route, IndexRoute } from 'react-router';
import { Link } from 'react-router';
import { FormattedMessage } from 'react-intl';
function CoreLayout(props) {
return (
<div>
<FormattedMessage
id="greeting"
description="Welcome greeting to the user"
defaultMessage="Hello, {name}! How are you today?"
values={{name: 'World'}}
/>
{props.children}
</div>
);
}
function HomeView() {
return (
<div>
Home!
<Link to="/auth">Auth</Link>
</div>
);
}
function AuthView() {
return (
<div>
Auth!
<Link to="/">Home</Link>
</div>
);
}
export default (
<Route path="/" component={CoreLayout}>
<IndexRoute component={HomeView} />
<Route path="/auth" component={AuthView} />
</Route>
);