-
Notifications
You must be signed in to change notification settings - Fork 74
Stefany porras #29
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
base: master
Are you sure you want to change the base?
Stefany porras #29
Conversation
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.
Looks good overall, just added a couple of comments. Let me know if you want some help with the husky issues. Please also change your base branch to master, instead of the one you forked the project from.
| "lint-staged": { | ||
| "*.{js, jsx, css, json}": [ | ||
| "yarn run lint:fix", | ||
| "pretty-quick --staged", | ||
| "git add" | ||
| ] | ||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "lint-staged" | ||
| } |
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.
What were the problems with husky?, I might be able to help you with that.
| import styled from 'styled-components'; | ||
|
|
||
|
|
||
| const CardContainer = styled.div` |
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 suggest to put your styled components into its styled.js file, this way you'll have a more cleaner component. You could do something like:
// styled.js
export const CardContainer = styled.div`
...
`
// CardVideo.component.jsx
import { CardContainer } from './styled';| import React from 'react'; | ||
| import styled from 'styled-components'; | ||
| import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
| import { faBars, faUser } from '@fortawesome/free-solid-svg-icons' |
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 to import the fontawesome icons using the Icon Library approach, this way your bundle get smaller. This is what fontawesome suggests:
https://fontawesome.com/how-to-use/javascript-api/setup/importing-icons
Once imported, you can use FontAwesomeIcon with the prop icon='name' to actually use it.
| function Navbar() { | ||
|
|
||
| return ( | ||
| <> |
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.
Since Header is your root component here, you don't need to use fragments. Also check the comment about moving your styled components outside your main component.
| <> | ||
| <Navbar/> | ||
| <CardsContainer> | ||
| {listVideos.items.map((item)=>{return <CardVideo key={item.etag} item={{item}}/>})} |
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 could omit the return if you do:
{listVideos.items.map((item) => <CardVideo key={item.etag} item={{item}} />)}Also, I think you added extra {} to your item prop. That's why you are doing props.item.item in your CardVideo component.
| `; | ||
|
|
||
|
|
||
| function CardVideo(props){ |
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 extract the props using destructuring, so it is cleaner in your component, like so:
function CardVideo({ item }) {Check the comment about the extra {} cause I think it wasn't intended.
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.
Now that you are using props, it could be useful to put in place a set of rules for those props, so that the component expects exactly what you meant. Check the documentation for these and let me know if you have any questions:
Cambios correspondientes a "Mini-Challenge 1: Core Concepts and Styling"