forked from reactplay/react-play
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
managed the state through redux to render the question page and creat…
…ed selectors for fetching the data from the state
- Loading branch information
1 parent
afcec42
commit 2b18fbe
Showing
16 changed files
with
103 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 23 additions & 14 deletions
37
src/plays/quizeo/src/components/directory/directory.component.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
import React from "react"; | ||
import { connect } from "react-redux"; | ||
import { createStructuredSelector } from "reselect"; | ||
import { selectDirectorySection } from "../../redux/directory/directory-selectors"; | ||
import MoviePage from "../../pages/moviePage/moviePage.component"; | ||
import { useSelector} from 'react-redux'; | ||
import MenuItem from "../menu-item/menuItem.component"; | ||
import { selectQuestionIndex, selectClickedAction} from "../../redux/movie/movieSelector"; | ||
|
||
import './directory.styles.css'; | ||
const Directory = ({sections}) => { | ||
return ( | ||
<div className="directoryMenu"> | ||
{sections.map(({id, ...otherSectionComponent}) => ( | ||
<MenuItem key={id} {...otherSectionComponent}/> | ||
))} | ||
</div> | ||
const Directory = () => { | ||
|
||
let questionIndex = useSelector(selectQuestionIndex); | ||
let isClick = useSelector(selectClickedAction); | ||
const sections = useSelector(selectDirectorySection); | ||
|
||
return ( | ||
<div> | ||
{ | ||
isClick ? <MoviePage categoryId={questionIndex}/> : | ||
<div className="directoryMenu"> | ||
{sections.map(({id, ...otherSectionComponent}) => ( | ||
<MenuItem key={id} {...otherSectionComponent}/> | ||
))} | ||
</div> | ||
} | ||
</div> | ||
); | ||
} | ||
|
||
const mapStateToProps = createStructuredSelector({ | ||
sections: selectDirectorySection | ||
}) | ||
export default connect(mapStateToProps)(Directory); | ||
|
||
export default Directory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.directoryMenu{ | ||
display: flex; | ||
margin: 3rem; | ||
display: flex; | ||
flex-direction: row; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.header{ | ||
cursor: pointer; | ||
margin-top: 1.5rem; | ||
margin-bottom: 3.5rem; | ||
font-size: 3rem; | ||
|
24 changes: 7 additions & 17 deletions
24
src/plays/quizeo/src/components/menu-item/menuItem.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
|
||
.question-model{ | ||
margin-top:-4%; | ||
width: 75%; | ||
width: 50%; | ||
} | ||
|
||
.category-title{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { createStore } from "redux"; | ||
import { createStore,applyMiddleware } from "redux"; | ||
import { persistStore } from "redux-persist"; | ||
|
||
import logger from "redux-logger"; | ||
import rootReducer from './root-reducer'; | ||
|
||
const store = createStore(rootReducer); | ||
const middleware = [logger]; | ||
|
||
const store = createStore(rootReducer, applyMiddleware(...middleware)); | ||
const persistor = persistStore(store); | ||
|
||
export {store, persistor}; |