Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
042e6c5
styled components installed
lex-villa Mar 12, 2021
de0dfb9
Navigation folder structure added
lex-villa Mar 12, 2021
7e4b5ea
header started and burger button ready
lex-villa Mar 13, 2021
9cad491
header started and burger button ready
lex-villa Mar 13, 2021
f1c0180
burger button responsive
lex-villa Mar 13, 2021
7fa1c3a
sidreDrawer added
lex-villa Mar 14, 2021
cc8ed92
sidreDrawer added
lex-villa Mar 14, 2021
2891168
NavLinks added
lex-villa Mar 14, 2021
39a93a9
NavLinks added
lex-villa Mar 14, 2021
8f595b7
seacrh bar added
lex-villa Mar 15, 2021
140438e
seacrh bar added
lex-villa Mar 15, 2021
307c4cf
cursor text added to label
lex-villa Mar 15, 2021
ee3ea0c
toggle and log component added
lex-villa Mar 16, 2021
7cc1863
toggle and log component added
lex-villa Mar 16, 2021
94f63cf
grid in home view added
lex-villa Mar 17, 2021
11d9000
grid in home view added
lex-villa Mar 17, 2021
6ff4c18
test to <VideoListHome /> added
lex-villa Mar 19, 2021
81f0798
test to <VideoListHome /> added
lex-villa Mar 19, 2021
d67c05e
test config added
lex-villa Mar 19, 2021
97311d2
first try to have the text plain report from the testing
lex-villa Mar 19, 2021
9bdf31e
improvements based on feedback
lex-villa Mar 26, 2021
615d6a4
Merge branch 'Mini-Challenge-1--Core-Concepts-and-Styling' of https:/…
lex-villa Mar 26, 2021
03ddc60
improvements based on feedback
lex-villa Mar 26, 2021
25769bc
Merge pull request #1 from lex-villa/Mini-Challenge-1--Core-Concepts-…
lex-villa Mar 26, 2021
6067848
fetch info for home view is ready
lex-villa Mar 27, 2021
c394dce
search input functionality added
lex-villa Mar 28, 2021
fd9e0cb
icon input functionality added
lex-villa Mar 28, 2021
0e6e6db
video player shows the clicked video
lex-villa Mar 29, 2021
9c4004b
video player shows the clicked video
lex-villa Mar 29, 2021
584be7d
suggested videos are fetched correctly
lex-villa Mar 29, 2021
acad282
suggested videos are fetched correctly
lex-villa Mar 29, 2021
25777ec
list of suggested videos styled
lex-villa Mar 30, 2021
60ce15a
video player styled
lex-villa Mar 30, 2021
9bf15da
global context implemented
lex-villa Mar 30, 2021
e630c4b
context management improved
lex-villa Apr 1, 2021
6f06db6
context management improved
lex-villa Apr 1, 2021
c490633
dark mode with styled components added
lex-villa Apr 7, 2021
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
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REACT_APP_GOOGLE_API_KEY=AIzaSyDN0P1UB4W39-XdmmA9wniCAlXA0f3WprU
Copy link
Owner

Choose a reason for hiding this comment

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

I recommend removing this file, you should never upload these types of files

REACT_APP_YOUTUBE_API_V3_SEARCH_URL=https://www.googleapis.com/youtube/v3/search
REACT_APP_YOUTUBE_API_V3_VIDEOS_URL=https://www.googleapis.com/youtube/v3/videos
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"arrowParens": "always"
}
"arrowParens": "always",
"endOfLine": "auto"
}
4 changes: 4 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["@babel/plugin-transform-react-jsx"],
"presets": ["@babel/env", "@babel/react"]
}
13 changes: 13 additions & 0 deletions coverage.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
--------------------------------|----------|----------|----------|----------|----------------|
CardHomePreview\ | 100 | 100 | 100 | 100 | |
CardHomePreview.component.jsx | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
VideoListHome\ | 100 | 100 | 100 | 100 | |
VideoListHome.component.jsx | 100 | 100 | 100 | 100 | |
--------------------------------|----------|----------|----------|----------|----------------|
All files | 100 | 100 | 100 | 100 | |
--------------------------------|----------|----------|----------|----------|----------------|

Done
26 changes: 24 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,28 @@
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^10.4.9",
"@testing-library/user-event": "^12.1.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"istanbul": "^0.4.5",
"jest-cli": "^26.6.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3"
"react-scripts": "3.4.3",
"react-transition-group": "^4.4.1",
"styled-components": "^5.2.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test": "jest --coverage && istanbul report --include coverage/coverage-final.json text > coverage.txt",
"eject": "react-scripts eject",
"lint": "eslint ./src --ext .js,.jsx",
"lint:fix": "eslint ./src --ext .js,.jsx --fix"
},
"devDependencies": {
"@babel/plugin-transform-react-jsx": "^7.12.17",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-eslint-comments": "^3.2.0",
Expand Down Expand Up @@ -57,5 +64,20 @@
"hooks": {
"pre-commit": "lint-staged"
}
},
"jest": {
"coveragePathIgnorePatterns": [
"/node_modules/",
"/src/index.js"
],
"coverageThreshold": {
"global": {
"statements": 60,
"branches": 60,
"lines": 60,
"functions": 60
}
},
"coverageReporters": ["json"]
}
}
6 changes: 5 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>wizeline youtube</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="backdrop-hook"></div>
<div id="modal-hook"></div>
<div id="drawer-hook"></div>
<div id="root"></div>
<!--
This HTML file is a template.
Expand Down
72 changes: 27 additions & 45 deletions src/components/App/App.component.jsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,40 @@
import React, { useLayoutEffect } from 'react';
import React, { useContext } from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';
import { ThemeProvider } from 'styled-components';

import AuthProvider from '../../providers/Auth';
import { GlobalStyles } from '../GlobalStyles.js/GlobalStyles';
import { lightTheme, darkTheme } from '../../utils/themes';
import HomePage from '../../pages/Home';
import LoginPage from '../../pages/Login';
import NotFound from '../../pages/NotFound';
import SecretPage from '../../pages/Secret';
import Private from '../Private';
import Fortune from '../Fortune';
import VideoDetails from '../../pages/VideoDetails/VideoDetails.component';
import Layout from '../Layout';
import { random } from '../../utils/fns';
import { Context } from '../../utils/store/Store';

function App() {
useLayoutEffect(() => {
const { body } = document;
const App = () => {
const state = useContext(Context)[0];
Copy link
Owner

Choose a reason for hiding this comment

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

I recommend using:
const [state] = useContext(Context)


function rotateBackground() {
const xPercent = random(100);
const yPercent = random(100);
body.style.setProperty('--bg-position', `${xPercent}% ${yPercent}%`);
}

const intervalId = setInterval(rotateBackground, 3000);
body.addEventListener('click', rotateBackground);

return () => {
clearInterval(intervalId);
body.removeEventListener('click', rotateBackground);
};
}, []);
const routes = (
<Switch>
<Route path="/" exact>
<HomePage />
</Route>
<Route path="/videoDetails/:videoId">
<VideoDetails />
</Route>
</Switch>
);

return (
<BrowserRouter>
<AuthProvider>
<Layout>
<Switch>
<Route exact path="/">
<HomePage />
</Route>
<Route exact path="/login">
<LoginPage />
</Route>
<Private exact path="/secret">
<SecretPage />
</Private>
<Route path="*">
<NotFound />
</Route>
</Switch>
<Fortune />
</Layout>
</AuthProvider>
<ThemeProvider theme={state.isDarkTheme ? darkTheme : lightTheme}>
<>
<GlobalStyles />
<Layout>
<main>{routes}</main>
</Layout>
</>
</ThemeProvider>
</BrowserRouter>
);
}
};

export default App;
25 changes: 25 additions & 0 deletions src/components/CardHomePreview/CardHomePreview.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { Card } from './CardHomePreview.styled';

const CardHomePreview = (props) => {
const history = useHistory();

const onClickHandler = () => {
history.push(`/videoDetails/${props.videoId}`);
};

return (
<Card onClick={onClickHandler}>
<div className="card-home-review__image">
<img src={`${props.image}`} alt={props.title} />
</div>
<div className="card-home-review__info">
<h2>{props.title}</h2>
<p>{props.description}</p>
</div>
</Card>
);
};

export default CardHomePreview;
44 changes: 44 additions & 0 deletions src/components/CardHomePreview/CardHomePreview.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styled from 'styled-components';

export const Card = styled.div`
position: relative;
margin: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
border-radius: 6px;
padding: 1rem;
overflow: hidden;
background: ${({ theme }) => theme.backgroundCard};
width: 100%;
height: 100%;
cursor: pointer;

.card-home-review__image {
width: 100%;
height: 7.5rem;
margin-right: 1.5rem;

img {
width: 100%;
height: 100%;
object-fit: cover;
}
}

.card-home-review__info {
padding: 1rem;
text-align: center;

h2,
p {
margin: 0 0 0.5rem 0;
}

h2 {
font-size: 20px;
}

p {
font-size: 16px;
}
}
`;
1 change: 1 addition & 0 deletions src/components/CardHomePreview/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './CardHomePreview.component';
52 changes: 52 additions & 0 deletions src/components/FormElements/Button/Button.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import { Link } from 'react-router-dom';

import { ButtonContainer } from './Button.styled';

const Button = (props) => {
if (props.href) {
return (
<ButtonContainer>
<a
className={`button button--${props.size || 'default'} ${
props.inverse && 'button--inverse'
} ${props.danger && 'button--danger'}`}
href={props.href}
>
{props.children}
</a>
</ButtonContainer>
);
}
if (props.to) {
return (
<ButtonContainer>
<Link
to={props.to}
exact={props.exact}
className={`button button--${props.size || 'default'} ${
props.inverse && 'button--inverse'
} ${props.danger && 'button--danger'}`}
>
{props.children}
</Link>
</ButtonContainer>
);
}
return (
<ButtonContainer>
<button
className={`button button--${props.size || 'default'} ${
props.inverse && 'button--inverse'
} ${props.danger && 'button--danger'}`}
type="button"
onClick={props.onClick}
disabled={props.disabled}
>
{props.children}
</button>
</ButtonContainer>
);
};

export default Button;
65 changes: 65 additions & 0 deletions src/components/FormElements/Button/Button.styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import styled from 'styled-components';

export const ButtonContainer = styled.div`
.button {
font: inherit;
padding: 0.5rem 1.5rem;
border: 1px solid #ff0055;
border-radius: 4px;
background: #ff0055;
color: white;
cursor: pointer;
margin-right: 1rem;
text-decoration: none;
display: inline-block;
}

.button:focus {
outline: none;
}

.button:hover,
.button:active {
background: #ff4382;
border-color: #ff4382;
}

.button--inverse {
background: transparent;
color: #ff0055;
}

.button--inverse:hover,
.button--inverse:active {
color: white;
background: #ff0055;
}

.button--danger {
background: #830000;
border-color: #830000;
}

.button--danger:hover,
.button--danger:active {
background: #f34343;
border-color: #f34343;
}

.button:disabled,
.button:hover:disabled,
.button:active:disabled {
background: #ccc;
color: #979797;
border-color: #ccc;
cursor: not-allowed;
}

.button--small {
font-size: 0.8rem;
}

.button--big {
font-size: 1.5rem;
}
`;
1 change: 1 addition & 0 deletions src/components/FormElements/Button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Button.component';
12 changes: 0 additions & 12 deletions src/components/Fortune/Fortune.component.jsx

This file was deleted.

Loading