From 0061ddf6275e5c6530994b3ab8a8b01b4a6dabea Mon Sep 17 00:00:00 2001 From: horhik Date: Fri, 22 May 2020 09:07:58 +0300 Subject: [PATCH] create redux store --- .idea/workspace.xml | 39 +++++++----------------- src/components/elements/recent-block.jsx | 1 + src/css/elements/page-links.scss | 3 -- src/index.js | 6 +++- src/reducers/all-reducers.js | 7 +++++ src/reducers/client-reducer.js | 14 +++++++++ src/reducers/main-page-reducer.js | 13 ++++++++ src/store.js | 6 ++++ 8 files changed, 57 insertions(+), 32 deletions(-) create mode 100644 src/components/elements/recent-block.jsx create mode 100644 src/reducers/all-reducers.js create mode 100644 src/reducers/client-reducer.js create mode 100644 src/reducers/main-page-reducer.js create mode 100644 src/store.js diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e09fcb4..92c3fcb 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -11,32 +11,14 @@ - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - + + @@ -131,7 +113,8 @@ - + + @@ -190,10 +173,10 @@ - + - + diff --git a/src/components/elements/recent-block.jsx b/src/components/elements/recent-block.jsx new file mode 100644 index 0000000..b45dfaa --- /dev/null +++ b/src/components/elements/recent-block.jsx @@ -0,0 +1 @@ +import React from 'react' diff --git a/src/css/elements/page-links.scss b/src/css/elements/page-links.scss index fb8994b..52760c6 100644 --- a/src/css/elements/page-links.scss +++ b/src/css/elements/page-links.scss @@ -16,9 +16,6 @@ color: var(--cyan); text-decoration: none; display: block; - &:visited{ - color: var(--purple); - } &:hover, &:focus{ color: var(--pink) } diff --git a/src/index.js b/src/index.js index 4d7f24c..9a9f618 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,14 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; +import {Provider} from "react-redux"; +import store from "./store"; ReactDOM.render( - + + + , document.getElementById("root") ); diff --git a/src/reducers/all-reducers.js b/src/reducers/all-reducers.js new file mode 100644 index 0000000..610d641 --- /dev/null +++ b/src/reducers/all-reducers.js @@ -0,0 +1,7 @@ +import {combineReducers} from "redux"; +import mainPageReducer from "./main-page-reducer"; +import clientReducer from "./client-reducer"; + +const rootReducer = combineReducers({mainPage: mainPageReducer, client: clientReducer}) + +export default rootReducer diff --git a/src/reducers/client-reducer.js b/src/reducers/client-reducer.js new file mode 100644 index 0000000..3b27654 --- /dev/null +++ b/src/reducers/client-reducer.js @@ -0,0 +1,14 @@ +const initialState = { + lang: 'en', + theme: 'dark', +} + +const clientReducer = (state = initialState, action) => { + switch (action.type) { + default: + return state + + } +} + +export default clientReducer \ No newline at end of file diff --git a/src/reducers/main-page-reducer.js b/src/reducers/main-page-reducer.js new file mode 100644 index 0000000..87a8598 --- /dev/null +++ b/src/reducers/main-page-reducer.js @@ -0,0 +1,13 @@ +const initialState = { + recentNews: ['nope'], + +} + +const mainPageReducer = (state = initialState, action) => { + switch (action.type) { + default: + return state + } +} + +export default mainPageReducer \ No newline at end of file diff --git a/src/store.js b/src/store.js new file mode 100644 index 0000000..351293b --- /dev/null +++ b/src/store.js @@ -0,0 +1,6 @@ +import { createStore } from 'redux' +import rootReducer from "./reducers/all-reducers"; + +const store = createStore(rootReducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()) + +export default store \ No newline at end of file