forked from wizeline/react-certification-2020
-
Notifications
You must be signed in to change notification settings - Fork 52
Mini challenge 4 #61
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
Open
alfredo-pacheco
wants to merge
14
commits into
wdonet:master
Choose a base branch
from
alfredo-pacheco:mini-challenge-4
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mini challenge 4 #61
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c4e678c
Header base structure
alfredo-pacheco f1b0e63
Home displaying videos from mock data
alfredo-pacheco ff54571
Remove unecessary code
alfredo-pacheco f34c32a
Testing
alfredo-pacheco ee5ac57
useVideos hook able to load videos from youtube
alfredo-pacheco 5a7ec91
- Loading videos working.
alfredo-pacheco 2d67fd2
search videos working
alfredo-pacheco 2ca0e96
Moving VideList into List folder
alfredo-pacheco daebb1d
- VideoDetail able to display single video.
alfredo-pacheco 1bf5ad7
Overlay for video detail
alfredo-pacheco f6eb855
Related Videos displayed correctly
alfredo-pacheco be5526e
- open related video.
alfredo-pacheco d30973c
Theme functionality
alfredo-pacheco ae065fe
Snapshots updated
alfredo-pacheco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,5 @@ | |
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| .vercel | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| yarn run v1.22.10 | ||
| $ react-scripts test --coverage | ||
| No tests found related to files changed since last commit. | ||
| ----------|----------|----------|----------|----------|-------------------| | ||
| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
| ----------|----------|----------|----------|----------|-------------------| | ||
| All files | 0 | 0 | 0 | 0 | | | ||
| ----------|----------|----------|----------|----------|-------------------| | ||
|
|
||
|
|
||
| [1B[JDone in 7.95s. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import React from 'react'; | ||
| import { ThemeProvider } from 'styled-components'; | ||
| import { useYouTube } from '../YouTube/YouTubeProvider'; | ||
|
|
||
| const theme = { | ||
| dark: { | ||
| primary: '#4396f3', | ||
| secondary: '#4a4646', | ||
| color: '#f7f7f7', | ||
| }, | ||
| }; | ||
|
|
||
| function MyThemeProvider({ children }) { | ||
| const { state } = useYouTube(); | ||
| const { theme: stateTheme } = state; | ||
| return <ThemeProvider theme={theme[stateTheme] || {}}>{children}</ThemeProvider>; | ||
| } | ||
|
|
||
| export default MyThemeProvider; | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from 'react'; | ||
| import { useYouTube } from '../../YouTube/YouTubeProvider'; | ||
| import { Col, HeaderContainer, Search, Space, Switch } from './Header.styled'; | ||
|
|
||
| const Header = () => { | ||
| const { state, dispatch } = useYouTube(); | ||
| const { search = '', theme } = state; | ||
|
|
||
| const setSearch = (event) => { | ||
| dispatch({ type: 'search', payload: event.target.value }); | ||
| }; | ||
|
|
||
| return ( | ||
| <HeaderContainer> | ||
| <Col>React Bootcamp</Col> | ||
| <Col> | ||
| <Search placeholder="Search" value={search} onChange={setSearch} /> | ||
| </Col> | ||
| <Space /> | ||
| <Col> | ||
| <Switch | ||
| onClick={() => { | ||
| dispatch({ type: 'switchTheme' }); | ||
| }} | ||
| > | ||
| {theme === 'dark' ? 'Default' : 'Dark'} | ||
| </Switch> | ||
| </Col> | ||
| </HeaderContainer> | ||
| ); | ||
| }; | ||
|
|
||
| export default Header; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| const Col = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| margin: 0 10px; | ||
| `; | ||
|
|
||
| const HeaderContainer = styled.div` | ||
| display: flex; | ||
| flex-direction: row; | ||
| height: 70px; | ||
| align-items: center; | ||
| padding: 5px; | ||
| border-bottom: 3px solid darkgray; | ||
| background-color: lightgray; | ||
| ${({ theme }) => (theme.primary ? `background-color: ${theme.primary}` : '')}; | ||
| ${({ theme }) => (theme.color ? `color: ${theme.color}` : '')}; | ||
| `; | ||
|
|
||
| const Search = styled.input` | ||
| background-color: lightyellow; | ||
| border: 0; | ||
| display: flex; | ||
| height: 1.8rem; | ||
| padding: 5px; | ||
| `; | ||
|
|
||
| const Space = styled.div` | ||
| display: flex; | ||
| flex: 1; | ||
| `; | ||
|
|
||
| const Switch = styled.span` | ||
| height: 40px; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| `; | ||
|
|
||
| const User = styled.span` | ||
| height: 40px; | ||
| background-color: springgreen; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| `; | ||
|
|
||
| export { Col, HeaderContainer, Search, Space, Switch, User }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* eslint-disable react/jsx-filename-extension */ | ||
| import React from 'react'; | ||
| import { shallow } from 'enzyme'; | ||
| import Header from './Header'; | ||
| import { YouTubeProvider } from '../../YouTube/YouTubeProvider'; | ||
|
|
||
| describe('Header', () => { | ||
| it('should render Header component correctly', () => { | ||
| const wrapper = shallow( | ||
| <YouTubeProvider> | ||
| <Header /> | ||
| </YouTubeProvider> | ||
| ); | ||
|
|
||
| expect(wrapper).toMatchSnapshot(); | ||
| }); | ||
| }); |
3 changes: 3 additions & 0 deletions
3
src/components/Layout/Header/__snapshots__/Header.test.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`Header should render Header component correctly 1`] = `ShallowWrapper {}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from './Header'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,21 @@ | ||
| import React from 'react'; | ||
|
|
||
| import './Layout.styles.css'; | ||
| import VideoDetail from '../YouTube/Detail/VideoDetail'; | ||
| import { useYouTube } from '../YouTube/YouTubeProvider'; | ||
| import Header from './Header'; | ||
| import { Content, MainContainer } from './Layout.styled'; | ||
|
|
||
| function Layout({ children }) { | ||
| return <main className="container">{children}</main>; | ||
| const { state } = useYouTube(); | ||
| const { currentVideo } = state; | ||
| return ( | ||
| <> | ||
| <MainContainer> | ||
| <Header>This is the header</Header> | ||
| <Content>{children}</Content> | ||
| </MainContainer> | ||
| {currentVideo && <VideoDetail />} | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default Layout; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| const MainContainer = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| height: 100vh; | ||
| ${({ theme }) => (theme.secondary ? `background-color: ${theme.secondary}` : '')}; | ||
| ${({ theme }) => (theme.color ? `color: ${theme.color}` : '')}; | ||
| `; | ||
|
|
||
| const Content = styled.div` | ||
| display: flex; | ||
| flex: 1; | ||
| flex-direction: column; | ||
| justify-content: flex-start; | ||
| align-items: stretch; | ||
| overflow-y: scroll; | ||
| `; | ||
|
|
||
| export { MainContainer, Content }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* eslint-disable react/jsx-filename-extension */ | ||
| import React from 'react'; | ||
| import { shallow } from 'enzyme'; | ||
| import Layout from './Layout.component'; | ||
| import { YouTubeProvider } from '../YouTube/YouTubeProvider'; | ||
|
|
||
| describe('Layout', () => { | ||
| it('should render Layout component correctly', () => { | ||
| const wrapper = shallow( | ||
| <YouTubeProvider> | ||
| <Layout /> | ||
| </YouTubeProvider> | ||
| ); | ||
|
|
||
| expect(wrapper).toMatchSnapshot(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`Layout should render Layout component correctly 1`] = `ShallowWrapper {}`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This theme provider looks good!