Skip to content

Commit

Permalink
Index page for viewing suggested titles lmcjt37#5
Browse files Browse the repository at this point in the history
  • Loading branch information
isaniomoraes committed Oct 21, 2018
1 parent 96ad244 commit 0a263e3
Show file tree
Hide file tree
Showing 15 changed files with 27,662 additions and 0 deletions.
21 changes: 21 additions & 0 deletions curated-tv-and-film/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

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

npm-debug.log*
yarn-debug.log*
yarn-error.log*
2,567 changes: 2,567 additions & 0 deletions curated-tv-and-film/README.md

Large diffs are not rendered by default.

14,841 changes: 14,841 additions & 0 deletions curated-tv-and-film/package-lock.json

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions curated-tv-and-film/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "curated-tv-and-film",
"version": "0.1.0",
"private": true,
"homepage": "https://lmcjt37.github.io/curated-tv-and-film/",
"dependencies": {
"bootstrap": "^4.1.3",
"gh-pages": "^2.0.1",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "2.0.5",
"reactstrap": "^6.5.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
40 changes: 40 additions & 0 deletions curated-tv-and-film/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/video-camera.png">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#eeeeee">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. 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>Curated TV and Film</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>
15 changes: 15 additions & 0 deletions curated-tv-and-film/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Binary file added curated-tv-and-film/public/video-camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions curated-tv-and-film/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.main-header {
margin-top: 30px;
margin-bottom: 30px;
}

.main-header h1 {
margin: 0;
}

.content-filter input {
font-size: 18px;
padding: 20px 10px;
}

.content-list {
margin-top: 60px;
margin-bottom: 60px;
}

.content-list ul {
list-style: none;
margin: 0;
padding: 0;
}

.content-list ul li + li {
margin-top: 60px;
}

.item-thumbnail img {
max-width: 100%;
height: auto;
border-radius: 6px;
box-shadow: 0 1px 10px 4px rgba(0,0,0,0.2);
}

.item-imdb {
display: block;
margin-top: 10px;
}

.item-imdb a {
margin-left: 5px;
}

.tvshow-details__item + .tvshow-details__item {
margin-top: 5px;
}
87 changes: 87 additions & 0 deletions curated-tv-and-film/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import React, { Component } from 'react';
import './App.css';
import content from './content.js';

var data = content;

class App extends Component {
constructor(props) {
super(props);

this.state = {
searchString: "",
content: content
}
}

handleChange = (event) => {
var searchString = event.target.value;
this.setState({searchString: searchString});

searchString = searchString.trim().toLowerCase();

if(searchString.length > 0) {
var searchResult = this.state.content.filter((el) =>
el.title.toLowerCase().match(searchString));
this.setState({content: searchResult});
} else {
this.setState({content: data});
}
}

render() {
return (
<section className="app container">
<header className="main-header">
<h1>Curated TV and Film</h1>
</header>
<main className="main-content">
<div className="content-filter">
<input type="text" className="form-control" value={this.state.searchString} onChange={this.handleChange} placeholder="Search here"/>
</div>
<div className="content-list">
{this.state.content.length ? (
<ul>
{this.state.content.map((item, index) => {
return (
<li key={index}>
<div className="row">
<div className="item-thumbnail col-md-6">
<a target="_blank" rel="noopener noreferrer" href={item.url}>
<img src={item.thumbnail} alt={item.title}/>
</a>
</div>
<div className="item-info col-md-6">
<h2>{item.title}{item.year ? (" (" + item.year + ")") : ''}</h2>
{item.type === "tv_show" &&
<div className="tvshow-details">
<div className="tvshow-details__item"><span>Season:</span> {item.season}</div>
<div className="tvshow-details__item"><span>Episode:</span> {item.episode}</div>
<div className="tvshow-details__item"><span>Episode Title:</span> {item.episode_title}</div>
</div>
}
<div className="item-imdb">
<span>IMDB:</span><a target="_blank" rel="noopener noreferrer" href={item.imdb}>{item.imdb}</a>
</div>
</div>
</div>
</li>
)
})}
</ul>
) : (
this.state.searchString ? (
<p>No search result</p>
) : (
<p>Can't load the data.</p>
)
)
}
</div>
</main>
</section>
);
}
}

export default App;
9 changes: 9 additions & 0 deletions curated-tv-and-film/src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
60 changes: 60 additions & 0 deletions curated-tv-and-film/src/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
var content = [
{
type: "tv_show",
title: "The Newsroom",
season: 1,
episode: 1,
episode_title: "We Just Decided To",
imdb: "http://www.imdb.com/title/tt1870479/",
url: "https://www.youtube.com/watch?v=wTjMqda19wk",
thumbnail: "https://camo.githubusercontent.com/edfa82b8adb068698bbe4a3bc04b8825870b3fa5/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f77546a4d7164613139776b2f302e6a7067"
},
{
type: "tv_show",
title: "Mr.Robot",
season: 2,
episode: 3,
episode_title: "eps2.1_k3rnel-pan1c.ksd",
imdb: "http://www.imdb.com/title/tt4158110/",
url: "https://www.youtube.com/watch?v=AZeLHD-725o",
thumbnail: "https://camo.githubusercontent.com/8fef1a38c7e3bd3f2ce6ade41373c17755545996/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f415a654c48442d3732356f2f302e6a7067"
},
{
type: "tv_show",
title: "Silicon Valley",
season: 1,
episode: 8,
episode_title: "Optimal Tip-To-Top Efficiency",
imdb: "http://www.imdb.com/title/tt2575988/",
url: "https://www.youtube.com/watch?v=mMeqEDEfniA",
thumbnail: "https://camo.githubusercontent.com/43dac8b3bb734eff5c7b737756a10efec8e85b77/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f6d4d6571454445666e69412f302e6a7067"
},
{
type: "tv_show",
title: "Game of Thrones",
season: 6,
episode: 9,
episode_title: "Battle of the Bastards",
imdb: "https://www.imdb.com/title/tt4283088/?ref_=ttep_ep9",
url: "https://www.youtube.com/watch?v=m8rURwkvOx0",
thumbnail: "https://camo.githubusercontent.com/a179e6c7a7b049589ea0b016919f837e45150d42/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f6d38725552776b764f78302f302e6a7067"
},
{
type: "movie",
title: "Oldboy",
year: 2003,
imdb: "http://www.imdb.com/title/tt0364569/",
url: "",
thumbnail: "https://camo.githubusercontent.com/542cfde27c129a73e8bd5897239ce714f7395207/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f56774949447a72565664632f302e6a7067"
},
{
type: "movie",
title: "Olympus has fallen",
year: 2013,
imdb: "https://www.imdb.com/title/tt2302755/",
url: "",
thumbnail: "https://camo.githubusercontent.com/c4fc2f1db0a033f165f0484ae07424bccd4b8b06/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f4e3857586974446e415f552f302e6a7067"
},
];

export default content;
14 changes: 14 additions & 0 deletions curated-tv-and-film/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
13 changes: 13 additions & 0 deletions curated-tv-and-film/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();
Loading

0 comments on commit 0a263e3

Please sign in to comment.