-
Notifications
You must be signed in to change notification settings - Fork 62
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
Pull Request - Francisco Rafael Arce García #58
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,2 @@ | |||
REACT_APP_API_KEY=iSAbLNTnHlhG33VP27yEQDITzhxAZ1iZ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend that you add this file to your .gitignore as this are api keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thnks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thnks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You pushed it? I can still see your .env config
To get started, edit <code>src/App.js</code> and save to reload. | ||
</p> | ||
</div> | ||
<React.Fragment> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fragments, well done!
src/Containers/SearchPage/saga.js
Outdated
|
||
function* doQuerySearch({ param = {} }) { | ||
var q; | ||
param.q===""||param.q===undefined||param.q===null? q="pato":q=param.q; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinda
const q = !para.q ? "pato" : param.q;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if someone for some reason get in the search view without looking for something the "pato" search happen.
src/Containers/SearchPage/index.js
Outdated
componentDidMount() { | ||
const { querySearch } = this.props; | ||
querySearch({q:this.props.location.state.query}); | ||
console.log(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I advise you delete console.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/Containers/SearchPage/index.js
Outdated
const { querySearch } = this.props; | ||
querySearch({q:this.props.location.state.query}); | ||
console.log(); | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
super(props); | ||
this.state = { | ||
buttonText: "Fav", | ||
fav: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you are replicating Redux store with the state. redux store should be the only source of true. Plus, If you can avoid states in your components would be better. (States only should be used for little things).
return ( | ||
< React.Fragment > | ||
<Wraper onClick = {this.onClick}> | ||
<ImgStyled src={require("./"+this.state.buttonText+".png")} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you have 2 img?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One is a heart button and the other one is the gif
class Navbar extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using a state here if you don't update it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I update it when I write in my input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you are right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
src/components/Navbar.style.js
Outdated
import styled from 'styled-components' | ||
|
||
export const UlStyled=styled.ul` | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need brackets
|
||
exports[`Styled gif works 1`] = ` | ||
<div | ||
className="sc-bdVaJa jbzoYE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use jest-styled-components for the snapshot.
@@ -0,0 +1,9 @@ | |||
import React from 'react' | |||
import renderer from 'react-test-renderer' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use enzyme
background-color: #333; | ||
` | ||
export const LiStyled=styled.li` | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need the brackets again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix it
import Fav from "../Containers/FavPage"; | ||
import Search from "../Containers/SearchPage"; | ||
|
||
const Routes = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to change into dynamic routing mindset, in this case every route is at the same index but defining your routes on a separate file before anything renders is reinforcing static practices.
As your application grow larger it might not make a lot of sense to isolate routes this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D I will work on that. Thanks for your feedback
const Routes = () => { | ||
return ( | ||
<React.Fragment> | ||
<Switch> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
<React.Fragment> | ||
<UlStyled> | ||
<LiStyled> | ||
<NavLink to="/">Home</NavLink> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
<NavLink to="/">Home</NavLink> | ||
</LiStyled> | ||
<LiStyled> | ||
<NavLink to="/fav">Favs</NavLink> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
export function addFav(params) { | ||
return { | ||
type: ADD_FAV, | ||
params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The related data
of an action should be contained in a payload
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I'll consider it next time.
} | ||
|
||
onClick() { | ||
if (this.props.gif.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid this state
management leveraging the fav
logic to the store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will work on that.
) | ||
) | ||
|
||
store.runSaga = sagaMiddleware.run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bad practice to 'enhance' the store this way. Calling runSaga
on the saga middleware is a better approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Thanks for your feedback.
No description provided.