Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/components/Layout/Content.component.jsx
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');
Copy link

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


function ContentComponent() {
console.log(data.items.lenght)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const element = data && data.items.map((item)=>(
<BlockElement>
Copy link

Choose a reason for hiding this comment

The 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.

Copy link

Choose a reason for hiding this comment

The 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:

  • title
  • description
  • thumbnail
  • etc

<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;
27 changes: 27 additions & 0 deletions src/components/Layout/Content.styles.js
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%;
`;
27 changes: 27 additions & 0 deletions src/components/Layout/Header.component.jsx
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
Copy link

Choose a reason for hiding this comment

The 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;
63 changes: 63 additions & 0 deletions src/components/Layout/Header.styles.js
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``;
3 changes: 1 addition & 2 deletions src/components/Layout/Layout.styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
justify-content: space-between;
align-items: center;
margin-top: -3rem;
}
7 changes: 7 additions & 0 deletions src/components/Layout/__tests__/Header.component.test.js
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', () => {
Copy link

Choose a reason for hiding this comment

The 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.


});
});
Loading