Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env

npm-debug.log*
yarn-debug.log*
Expand Down
17,449 changes: 17,449 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/react-fontawesome": "^0.1.14",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^10.4.9",
"@testing-library/user-event": "^12.1.3",
"prop-types": "^15.7.2",
"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",
"styled-components": "^5.2.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:coverage": "react-scripts test --coverage",
"eject": "react-scripts eject",
"lint": "eslint ./src --ext .js,.jsx",
"lint:fix": "eslint ./src --ext .js,.jsx --fix"
Expand All @@ -30,9 +36,12 @@
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.0",
"husky": "^4.2.5",
"jest": "^24.9.0",
"jest-styled-components": "^7.0.3",
"lint-staged": "^10.2.13",
"prettier": "^2.1.1",
"pretty-quick": "^3.0.0"
"pretty-quick": "^3.0.0",
"react-test-renderer": "^17.0.1"
},
"browserslist": {
"production": [
Expand All @@ -58,4 +67,4 @@
"pre-commit": "lint-staged"
}
}
}
}
21 changes: 1 addition & 20 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,10 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
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>React Bootcamp Project</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
12 changes: 1 addition & 11 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
}
58 changes: 0 additions & 58 deletions src/components/App/App.component.jsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/App/index.js

This file was deleted.

66 changes: 66 additions & 0 deletions src/components/App/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React, { useState, useEffect } from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';
import { ThemeProvider } from 'styled-components';
import { lightTheme, darkTheme } from '../../theme';
import GlobalStyle from '../../theme/globalStyle';

import AuthProvider from '../../providers/Auth';
import YoutubeDataProvider from '../../providers/YoutubeData';
import GlobalProvider from '../../providers/Global';

import Header from '../Header';
import ProtectedRoute from '../ProtectedRoute';
import HomePage from '../../pages/Home';
import VideoPage from '../../pages/Video';
import FavoritesPage from '../../pages/Favorites';

function App() {
const [theme, setTheme] = useState('light');
const [iframeAPIReady, setIframeAPIReady] = useState(false);
const handleThemeSwitch = () => {
const newTheme = theme === 'light' ? 'dark' : 'light';
setTheme(newTheme);
};

useEffect(() => {
const iframeScript = document.createElement('script');
iframeScript.src = 'https://www.youtube.com/iframe_api';
iframeScript.async = true;
iframeScript.addEventListener('load', () => {
window.onYouTubeIframeAPIReady = () => {
setIframeAPIReady(true);
};
});
document.body.appendChild(iframeScript);
}, []);

return (
<>
<GlobalStyle theme={theme === 'light' ? lightTheme : darkTheme} />
<BrowserRouter>
<AuthProvider>
<YoutubeDataProvider iframeAPIReady={iframeAPIReady}>
<GlobalProvider>
<ThemeProvider theme={theme === 'light' ? lightTheme : darkTheme}>
<Header handleThemeSwitch={handleThemeSwitch} />
<Switch>
<Route exact path="/">
<HomePage />
</Route>
<Route exact path="/video/:videoId">
<VideoPage />
</Route>
<ProtectedRoute exact path="/favorites">
<FavoritesPage />
</ProtectedRoute>
</Switch>
</ThemeProvider>
</GlobalProvider>
</YoutubeDataProvider>
</AuthProvider>
</BrowserRouter>
</>
);
}

export default App;
12 changes: 0 additions & 12 deletions src/components/Fortune/Fortune.component.jsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/components/Fortune/Fortune.styles.css

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Fortune/index.js

This file was deleted.

29 changes: 29 additions & 0 deletions src/components/Grid/__tests__/__snapshots__/grid.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Grid renders correctly 1`] = `
.c1 {
display: grid;
grid-template-columns: repeat(auto-fill,minmax(320px,1fr));
grid-gap: 1rem;
}

.c0 {
padding: 2rem;
}

<div
className="c0"
>
<ul
className="c1"
>

<div>
Hola
</div>
<div>
Adios
</div>
</ul>
</div>
`;
32 changes: 32 additions & 0 deletions src/components/Grid/__tests__/grid.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import renderer from 'react-test-renderer';
import { ThemeProvider } from 'styled-components';
import '@testing-library/jest-dom/extend-expect';
import 'jest-styled-components';

import Grid from '../index';
import AuthProvider from '../../../providers/Auth';
import YoutubeDataProvider from '../../../providers/YoutubeData';

import { lightTheme } from '../../../theme';

describe('Grid', () => {
test('renders correctly', () => {
const items = [<div key="1">Hola</div>, <div key="2">Adios</div>];
const tree = renderer
.create(
<BrowserRouter>
<AuthProvider>
<YoutubeDataProvider>
<ThemeProvider theme={lightTheme}>
<Grid gridItems={items} />
</ThemeProvider>
</YoutubeDataProvider>
</AuthProvider>
</BrowserRouter>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
12 changes: 12 additions & 0 deletions src/components/Grid/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { GridContainer, List } from './styled';

const Grid = ({ gridItems }) => {
return (
<GridContainer>
<List> {gridItems}</List>
</GridContainer>
);
};

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

const List = styled.ul`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
grid-gap: 1rem;
`;

const GridContainer = styled.div`
padding: 2rem;
`;

export { GridContainer, List };
Loading