mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Что-то вроде hello world для фронта
This commit is contained in:
15
src/index.html
Normal file
15
src/index.html
Normal 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
34
src/index.js
Normal 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
2
src/reducers.js
Normal file
@@ -0,0 +1,2 @@
|
||||
export default {
|
||||
};
|
||||
45
src/routes.js
Normal file
45
src/routes.js
Normal 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>
|
||||
);
|
||||
Reference in New Issue
Block a user