-
Notifications
You must be signed in to change notification settings - Fork 95
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
Minor - Mini-Challenge 1: Core Concepts and Styling #112
base: master
Are you sure you want to change the base?
Changes from 1 commit
f11a98a
d6c8bf7
a35500f
cfb8c4b
6442f1a
fe0fe9a
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
|
||
import { BlockElement, ContentWrapper, Description, VideoThumbnail } from './Content.styles'; | ||
|
||
let data = require('../../mockdata/youtube-videos-mock.json'); | ||
|
||
function ContentComponent() { | ||
console.log(data.items.lenght) | ||
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. Comment. 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. 👍 |
||
const element = data && data.items.map((item)=>( | ||
<BlockElement> | ||
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. Recommendation Podríamos crear un componente presentacional que se encargue renderizar un solo video. De esta forma nos permitiría mantener una función especifica a cada componente. 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. Como tip, evitemos que este nuevo componente reciba item, en cambio debería recibir cada una de las propiedades:
|
||
<VideoThumbnail src={item.snippet.thumbnails.medium.url} title={item.snippet.title} /> | ||
<Description> | ||
<h3>{item.snippet.title}</h3> | ||
<div>{item.snippet.description}</div> | ||
</Description> | ||
</BlockElement> | ||
|
||
)) | ||
return ( | ||
<ContentWrapper> | ||
{element} | ||
</ContentWrapper> | ||
) | ||
} | ||
|
||
export default ContentComponent; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const BlockElement = styled.div` | ||
flex: 1 0 21%; | ||
margin: 15px; | ||
background-color: white; | ||
box-shadow: 0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%); | ||
border-radius: 4px; | ||
overflow: hidden; | ||
`; | ||
export const ContentWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
flex-wrap: wrap; | ||
margin: 0 auto; | ||
width: 90%; | ||
row-gap: 10px; | ||
column-gap: 2em; | ||
`; | ||
|
||
export const Description = styled.div` | ||
padding: 10px; | ||
`; | ||
|
||
export const VideoThumbnail = styled.img` | ||
width: 100%; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
|
||
import { ButtonToggle, HeaderWrapper, Input, LogoLink, MenuToggle } from './Header.styles'; | ||
// import InsideSessionLogo from '../../resources/logo.png'; // TODO: Uncomment when login is ready | ||
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. Este comentario lo podemos eliminar antes de hacer el commit. |
||
import SessionOutLogo from '../../resources/session_out.png'; | ||
import { faBars, faToggleOff } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
|
||
function HeaderComponent() { | ||
return ( | ||
<HeaderWrapper> | ||
<Input type='text' placeholder={'Wizleine'}/> | ||
<ButtonToggle> | ||
<FontAwesomeIcon icon={faToggleOff} size="6x" style={{ color: 'white'}}/> | ||
</ButtonToggle> | ||
Dark Mode | ||
<LogoLink href="#"> | ||
<img src={SessionOutLogo} alt="Logo" /> | ||
</LogoLink> | ||
<MenuToggle href="#"> | ||
<FontAwesomeIcon icon={faBars} size="6x" style={{ color: 'white'}}/> | ||
</MenuToggle> | ||
</HeaderWrapper> | ||
); | ||
} | ||
|
||
export default HeaderComponent; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const HeaderWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 0 auto; | ||
padding: 10px 0px; | ||
width: 100%; | ||
background-color: blue; | ||
border-bottom: 1px solid rgba(0, 0, 0, 0.0975); | ||
`; | ||
|
||
export const LogoLink = styled.div` | ||
padding-right: 10px; | ||
img { | ||
max-width: 50px; | ||
height: auto; | ||
} | ||
`; | ||
|
||
export const MenuToggle = styled.div` | ||
display: block; | ||
width: 50px; | ||
padding: 5px; | ||
margin-right: 10px; | ||
svg{ | ||
height: auto; | ||
max-width: 100%; | ||
} | ||
`; | ||
|
||
export const ButtonToggle = styled.div` | ||
display: block; | ||
margin-left: auto; | ||
width: 30px; | ||
margin-right: 10px; | ||
svg{ | ||
height: auto; | ||
max-width: 100%; | ||
} | ||
`; | ||
|
||
export const Input = styled.input` | ||
font-size: 16px; | ||
border: solid 1px #dbdbdb; | ||
border-radius: 3px; | ||
color: #262626; | ||
padding: 7px 33px; | ||
border-radius: 3px; | ||
color: #999; | ||
cursor: text; | ||
font-size: 14px; | ||
font-weight: 300; | ||
text-align: center; | ||
background: #fafafa; | ||
|
||
&:active, | ||
&:focus { | ||
text-align: left; | ||
} | ||
`; | ||
|
||
export const MenuLink = styled.a``; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import HeaderComponent from '../Header.component'; | ||
|
||
describe('Header Component', () => { | ||
it('Should show HeaderComponent', () => { | ||
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. Recommendation Podemos utilizar it.todo para aquellos unit tests que no se encuentran implementados, de esta forma podremos ubicarlos facilmente en un futuro. Reference. |
||
|
||
}); | ||
}); |
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.
Question
Modificas data por algún otro valor?
En caso de no modificarse podríamos utilizar un const.
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.
👍