-
Notifications
You must be signed in to change notification settings - Fork 0
added BarCrawlItem styles etc #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
karypotter
wants to merge
3
commits into
master
Choose a base branch
from
newBranchKarina
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,31 +1,31 @@ | ||
| import * as actionTypes from './actionTypes'; | ||
|
|
||
| const initialState = { | ||
| allBars: [], | ||
| isBarListLoading: false, | ||
| barListLoadingError: {}, | ||
| } | ||
| allBars: [], | ||
| isBarListLoading: false, | ||
| barListLoadingError: {}, | ||
| }; | ||
|
|
||
| export function barsReducer(state = initialState, action) { | ||
| switch (action.type) { | ||
| case actionTypes.GET_ALL_BARS: | ||
| return { | ||
| ...state, | ||
| isBarListLoading: true, | ||
| }; | ||
| case actionTypes.GET_ALL_BARS_SUCCESS: | ||
| return { | ||
| ...state, | ||
| allBars: action.payload, | ||
| isBarListLoading: false, | ||
| }; | ||
| case actionTypes.GET_ALL_BARS_ERROR: | ||
| return { | ||
| ...state, | ||
| isBarListLoading: false, | ||
| barListLoadingError: action.payload, | ||
| } | ||
| default: | ||
| return state; | ||
| } | ||
| switch (action.type) { | ||
| case actionTypes.GET_ALL_BARS: | ||
| return { | ||
| ...state, | ||
| isBarListLoading: true, | ||
| }; | ||
| case actionTypes.GET_ALL_BARS_SUCCESS: | ||
| return { | ||
| ...state, | ||
| allBars: action.payload, | ||
| isBarListLoading: false, | ||
| }; | ||
| case actionTypes.GET_ALL_BARS_ERROR: | ||
| return { | ||
| ...state, | ||
| isBarListLoading: false, | ||
| barListLoadingError: action.payload, | ||
| }; | ||
| default: | ||
| return state; | ||
| } | ||
| } |
This file contains hidden or 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
7 changes: 7 additions & 0 deletions
7
src/ui/components/BarCrawlPage/BarCrawlItem/BarCrawlItem.scss
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| .barCrawl { | ||
| border: 2px solid rgb(212, 36, 36); | ||
| margin-left: 10px; | ||
| padding-left: 3px; | ||
| margin-top: 40px; | ||
| width: 300px; | ||
| } |
32 changes: 32 additions & 0 deletions
32
src/ui/components/BarCrawlPage/BarCrawlItem/BarCrawlItemComponent.js
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import React from 'react'; | ||
| import { object, func, string } from 'prop-types'; | ||
| import './BarCrawlItem.scss'; | ||
|
|
||
| const propTypes = { | ||
| barCrawlItem: object, | ||
| onClickHandler: func, | ||
| bcName: string, | ||
| bcTime: string, | ||
| bcPrice: string, | ||
| }; | ||
|
|
||
| const BarCrawlItemComponent = ({ barCrawlItem }) => { | ||
| const { bcName, bcTime, bcPrice } = barCrawlItem; | ||
| function onClickHandler() { | ||
| console.log(barCrawlItem._id); | ||
| } | ||
| return ( | ||
| <div className="barCrawl"> | ||
| <h2>{bcName}</h2> | ||
| <p>{bcTime}</p> | ||
| <p>{bcPrice}</p> | ||
| <button onClick={onClickHandler} type="button"> | ||
| test | ||
| </button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| BarCrawlItemComponent.propTypes = propTypes; | ||
|
|
||
| export { BarCrawlItemComponent }; |
File renamed without changes.
File renamed without changes.
This file contains hidden or 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
18 changes: 0 additions & 18 deletions
18
src/ui/components/BarCrawlPage/BarItem/BarCrawlItemComponent.js
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import React from 'react'; | ||
| import './BarItem.scss'; | ||
| import { object } from 'prop-types'; | ||
|
|
||
| const propTypes = { | ||
| barItem: object, | ||
| }; | ||
|
|
||
| const BarItemComponent = ({ barItem }) => { | ||
| const { barName, address, barInfo } = barItem; | ||
| function onClickHandler() { | ||
| console.log(barItem._id); | ||
| } | ||
| return ( | ||
| <div className="bar"> | ||
| <h2>{barName}</h2> | ||
| <p>{address}</p> | ||
| <p>{barInfo}</p> | ||
| <button onClick={onClickHandler} type="button"> | ||
| test | ||
| </button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| BarItemComponent.propTypes = propTypes; | ||
|
|
||
| export { BarItemComponent }; |
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from 'react'; | ||
| import BarItem from './BarItem'; | ||
|
|
||
| const BarPageComponent = ({ allBars }) => { | ||
| return ( | ||
| <div> | ||
| {allBars.map(item => { | ||
| return <BarItem barItem={item} />; | ||
| })} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default BarPageComponent; | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import React, { useEffect } from 'react'; | ||
| import { useDispatch, useSelector } from 'react-redux'; | ||
| import BarPageComponent from './BarPageComponent'; | ||
| import { getBars } from '../../../reduxStore/bars/actions'; | ||
| import { func } from 'prop-types'; | ||
|
|
||
| const propTypes = { | ||
| getBars: func, | ||
| }; | ||
|
|
||
| const BarPageContainer = () => { | ||
| const allBars = useSelector(state => state.barsReducer.allBars); | ||
| const dispatch = useDispatch(); | ||
|
|
||
| const useBar = someFetchActionCreator => { | ||
| useEffect(() => { | ||
| dispatch(someFetchActionCreator()); | ||
| }, [someFetchActionCreator]); | ||
| }; | ||
|
|
||
| useBar(getBars); | ||
|
|
||
| return <BarPageComponent allBars={allBars} />; | ||
| }; | ||
|
|
||
| BarPageContainer.propTypes = propTypes; | ||
|
|
||
| export default BarPageContainer; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import BarPageContainer from './BarPageContainer'; | ||
|
|
||
| export default BarPageContainer; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.