-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,4 @@ | |
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .netlify/ | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from 'react'; | ||
| import styled from 'styled-components'; | ||
|
|
||
|
|
||
| const CardContainer = styled.div` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to put your styled components into its // styled.js
export const CardContainer = styled.div`
...
`
// CardVideo.component.jsx
import { CardContainer } from './styled'; |
||
| width: 350px; | ||
| border-radius: 5px; | ||
| border: 1px solid #ddd; | ||
| margin: 10px; | ||
| overflow: hidden; | ||
| padding: 15px; | ||
| `; | ||
|
|
||
| const CardImg = styled.img` | ||
| width: 100%; | ||
| height: 140px; | ||
| `; | ||
|
|
||
|
|
||
| function CardVideo(props){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: |
||
| return( | ||
| <CardContainer> | ||
| <CardImg src={props.item.item.snippet.thumbnails.high.url}/> | ||
| <div> | ||
| <h4>{props.item.item.snippet.title.toString()}</h4> | ||
| <p>{props.item.item.snippet.description}</p> | ||
| </div> | ||
| </CardContainer> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| export default CardVideo; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from './CardVideo.component'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. I recommend to import the fontawesome icons using the https://fontawesome.com/how-to-use/javascript-api/setup/importing-icons Once imported, you can use |
||
|
|
||
|
|
||
| const Header = styled.header` | ||
| background-color: #957aa4; | ||
| color: white; | ||
| `; | ||
|
|
||
| const HeaderContainer = styled.div` | ||
| min-height: 70px; | ||
| display: flex; | ||
| flex-direction: row; | ||
| justify-content: space-between; | ||
| padding: 0 20px 0 20px; | ||
| align-items: center; | ||
| `; | ||
|
|
||
| const LoginButton = styled.button` | ||
| border:none; | ||
| background-color:grey; | ||
| border-radius: 50%; | ||
| outline:none; | ||
| padding:10px; | ||
| margin: 7px; | ||
| `; | ||
|
|
||
| const SidebarButton = styled.button` | ||
| border:none; | ||
| background-color:transparent; | ||
| border-radius: 50%; | ||
| outline:none; | ||
| padding: 0.7em; | ||
| margin: 1em; | ||
| `; | ||
|
|
||
|
|
||
| const HeaderInput = styled.input` | ||
| border: 0; | ||
| border-radius: 5px; | ||
| outline: none; | ||
| font-size: 0.9em; | ||
| padding: 0.4em; | ||
| `; | ||
|
|
||
| const SpanHeader = styled.span` | ||
| margin: 7px; | ||
| `; | ||
|
|
||
| const ModeControl1 = styled.div` | ||
| height: 10px; | ||
| background: #5f5d5d; | ||
| border-radius: 10px; | ||
| width: 35px; | ||
| margin: 7px; | ||
| `; | ||
|
|
||
| const ModeControl2 = styled.div` | ||
| height: 20px; | ||
| background: white; | ||
| border-radius: 10px; | ||
| position: relative; | ||
| width: 20px; | ||
| margin: 7px; | ||
| left: -12px; | ||
| top: -12px; | ||
| `; | ||
|
|
||
| const HeaderRightContainer = styled.div` | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| `; | ||
|
|
||
|
|
||
| function Navbar() { | ||
|
|
||
| return ( | ||
| <> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since |
||
| <Header> | ||
| <HeaderContainer> | ||
| <div> | ||
| <SidebarButton> | ||
| <FontAwesomeIcon icon={faBars} color="white" size="lg"/> | ||
| </SidebarButton> | ||
| <HeaderInput placeholder="wizeline" /> | ||
| </div> | ||
| <HeaderRightContainer> | ||
| <ModeControl1> | ||
| <ModeControl2></ModeControl2> | ||
| </ModeControl1> | ||
| <SpanHeader>Dark mode</SpanHeader> | ||
| <LoginButton> | ||
| <FontAwesomeIcon icon={faUser} color="white" size="lg"/> | ||
| </LoginButton> | ||
| </HeaderRightContainer> | ||
| </HeaderContainer> | ||
| </Header> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default Navbar; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from './Navbar.component'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| import React, { useRef } from 'react'; | ||
| import { Link, useHistory } from 'react-router-dom'; | ||
|
|
||
| import Navbar from "../../components/Layout/Navbar"; | ||
| import styled from 'styled-components'; | ||
| import CardVideo from "../../components/Layout/CardVideo"; | ||
| import {listVideos} from "../../utils/mocks/youtube-videos-mock"; | ||
| import { useAuth } from '../../providers/Auth'; | ||
| import './Home.styles.css'; | ||
|
|
||
|
|
@@ -15,24 +18,20 @@ function HomePage() { | |
| history.push('/'); | ||
| } | ||
|
|
||
| const CardsContainer = styled.div` | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| padding: 50px 50px 0 50px; | ||
| justify-content: center; | ||
| `; | ||
|
|
||
| return ( | ||
| <section className="homepage" ref={sectionRef}> | ||
| <h1>Hello stranger!</h1> | ||
| {authenticated ? ( | ||
| <> | ||
| <h2>Good to have you back</h2> | ||
| <span> | ||
| <Link to="/" onClick={deAuthenticate}> | ||
| ← logout | ||
| </Link> | ||
| <span className="separator" /> | ||
| <Link to="/secret">show me something cool →</Link> | ||
| </span> | ||
| </> | ||
| ) : ( | ||
| <Link to="/login">let me in →</Link> | ||
| )} | ||
| </section> | ||
| <> | ||
| <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 commentThe 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 |
||
| </CardsContainer> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
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.