-
Notifications
You must be signed in to change notification settings - Fork 8
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
List 1 #1
Open
mr-meetpatel
wants to merge
9
commits into
scalereal:master
Choose a base branch
from
mr-meetpatel:LIST-1
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.
+2,430
−17
Open
List 1 #1
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
905da8d
MP | HTML files
mr-meetpatel 5e19324
MP | CSS files
mr-meetpatel e14c399
MP | JS files
mr-meetpatel 1f1fce6
MP | other files
mr-meetpatel 26862fb
MP | Formatted HTML files
mr-meetpatel 3e77b25
MP | use css vairable and change the order
mr-meetpatel 6f0f04c
MP | created element add append it instead of innerHTML
mr-meetpatel b3e630f
MP | Change required css property
mr-meetpatel b42e676
MP | make required changes in css file
mr-meetpatel 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,6 +1,83 @@ | ||
import './style.css' | ||
import axios from "axios"; | ||
const key = "f9d119ddc9f2ae7c8b2c34f1d5910a87"; | ||
const api = `https://api.themoviedb.org/3/discover/movie?sort_by=popularity.desc&api_key=${key}`; | ||
const imgUrl = "https://image.tmdb.org/t/p/w500"; | ||
const searchUrl = `https://api.themoviedb.org/3/search/movie?api_key=${key}`; | ||
const app = document.querySelector("#app"); | ||
const movieData = document.querySelector(".movie-card"); | ||
const movieSearch = document.querySelector(".search-bar"); | ||
const errorDiv = document.querySelector(".no-movie-found"); | ||
let query = ""; | ||
|
||
document.querySelector('#app').innerHTML = ` | ||
<h1>Hello Vite!</h1> | ||
<a href="https://vitejs.dev/guide/features.html" target="_blank">Documentation</a> | ||
` | ||
async function getMovieFromApi(query) { | ||
const url = query === "" ? api : searchUrl + "&query=" + query; | ||
const response = await axios.get(url); | ||
const movieData = response.data.results.slice(0, 15); | ||
if (movieData.length) { | ||
app.style.display = "block"; | ||
showMovieData(movieData); | ||
errorDiv.style.display = "none"; | ||
} else { | ||
app.style.display = "none"; | ||
errorDiv.style.display = "block"; | ||
} | ||
} | ||
|
||
getMovieFromApi(query); | ||
|
||
movieSearch.addEventListener("keyup", (event) => { | ||
event.preventDefault(); | ||
query = event.target.value; | ||
getMovieFromApi(query); | ||
}); | ||
|
||
const showMovieData = (data) => { | ||
let count = 0; | ||
data.forEach((movie) => { | ||
const { poster_path, title } = movie; | ||
const div = document.createElement("div"); | ||
div.classList.add("card"); | ||
|
||
if (poster_path != null) { | ||
hhkk28 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let imgData = document.createElement(`img`); | ||
imgData.src = imgUrl + poster_path; | ||
imgData.alt = title; | ||
|
||
let h3Data = document.createElement(`h3`); | ||
h3Data.classList.add("card-item"); | ||
|
||
if (title.length > 16) { | ||
h3Data.innerText = title.substring(0, 17) + "..."; | ||
} else { | ||
h3Data.innerText = title; | ||
} | ||
let buttonData = document.createElement(`button`); | ||
buttonData.classList.add("btn"); | ||
buttonData.innerText = "Read More"; | ||
div.appendChild(imgData); | ||
div.appendChild(h3Data); | ||
div.appendChild(buttonData); | ||
} else { | ||
let imgData = document.createElement(`img`); | ||
imgData.src = "http://via.placeholder.com/1080x1580"; | ||
imgData.alt = title; | ||
|
||
let h3Data = document.createElement(`h3`); | ||
h3Data.classList.add("card-item"); | ||
if (title.length > 16) { | ||
h3Data.innerText = title.substring(0, 17) + "..."; | ||
} else { | ||
h3Data.innerText = title; | ||
} | ||
let buttonData = document.createElement(`button`); | ||
buttonData.classList.add("btn"); | ||
buttonData.innerText = "Read More"; | ||
|
||
div.appendChild(imgData); | ||
div.appendChild(h3Data); | ||
div.appendChild(buttonData); | ||
} | ||
|
||
movieData.appendChild(div); | ||
}); | ||
}; |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,8 +1,184 @@ | ||
:root { | ||
--light-grey: #626262; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
--white: #ffffff; | ||
} | ||
* { | ||
margin: 0; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
header { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.heading { | ||
font-family: "Roboto Mono"; | ||
font-size: 48px; | ||
font-weight: 400; | ||
margin: 12px 0 15px 0; | ||
} | ||
|
||
input[type="text"] { | ||
font-family: "Rubik"; | ||
padding-left: 20px; | ||
font-weight: 400; | ||
font-size: 16px; | ||
} | ||
|
||
.search-bar { | ||
height: 43px; | ||
width: 300px; | ||
border: 1px solid var(--light-grey); | ||
background: url("search.png"); | ||
background-repeat: no-repeat; | ||
background-position: right; | ||
background-position: calc(100% - 10px) center; | ||
} | ||
|
||
#app { | ||
font-family: Avenir, Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
margin: 66px auto 149px auto; | ||
max-width: 1200px; | ||
} | ||
|
||
.movie-card { | ||
position: relative; | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-around; | ||
gap: 48px 75px; | ||
} | ||
|
||
.card img { | ||
height: 374px; | ||
width: 350px; | ||
border-radius: 20px; | ||
opacity: 1; | ||
box-shadow: 0px 10px 20px 5px rgb(0 0 0 / 25%); | ||
} | ||
|
||
.card:hover::after{ | ||
opacity: 60%; | ||
background-color: #626262; | ||
} | ||
|
||
.card::after{ | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
width: 100%; | ||
height: 100%; | ||
transition: 250ms ease-out; | ||
border-radius: 20px; | ||
} | ||
|
||
.card { | ||
position: relative; | ||
} | ||
|
||
.card:hover button { | ||
display: block; | ||
opacity: 1; | ||
z-index: 3; | ||
} | ||
|
||
.card:hover h3 { | ||
display: block; | ||
opacity: 1; | ||
z-index: 3; | ||
} | ||
.card-item { | ||
position: absolute; | ||
left: 31.43%; | ||
top: 42.51%; | ||
color: var(--white); | ||
font-family: "Rubik"; | ||
font-style: normal; | ||
font-weight: 600; | ||
font-size: 24px; | ||
text-align: center; | ||
width: 122px; | ||
height: 56px; | ||
display: none; | ||
} | ||
|
||
.btn { | ||
position: absolute; | ||
left: 29.43%; | ||
top: 76.74%; | ||
text-align: center; | ||
color: #2c3e50; | ||
margin-top: 60px; | ||
background: #352c9a; | ||
border: none; | ||
display: none; | ||
color: var(--white); | ||
height: 37px; | ||
width: 125px; | ||
font-family: "Rubik"; | ||
font-size: 16px; | ||
font-weight: 600; | ||
} | ||
|
||
.btn:hover { | ||
background-color: #724fd8; | ||
} | ||
|
||
.btn:active { | ||
background-color: #724fdf; | ||
text-decoration: underline; | ||
} | ||
|
||
.btn:disabled { | ||
background-color: var(--light-grey); | ||
} | ||
|
||
.no-result { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.no-result img { | ||
max-width: 500px; | ||
width: 100%; | ||
} | ||
|
||
.section-item { | ||
margin-top: 96px; | ||
margin-bottom: 48px; | ||
font-family: "Rubik"; | ||
font-size: 32px; | ||
} | ||
|
||
@media (max-width: 767px) { | ||
.section-img { | ||
width: 400px; | ||
height: 360px; | ||
|
||
margin: 24px auto 81px auto; | ||
} | ||
.section-item { | ||
font-size: 30px; | ||
text-align: center; | ||
} | ||
} | ||
|
||
@media (max-width: 480px) { | ||
.heading { | ||
font-size: 36px; | ||
} | ||
.card img { | ||
width: 300px; | ||
height: 320px; | ||
margin: 24px 30px 24px 30px; | ||
} | ||
|
||
.btn { | ||
width: 125px; | ||
height: 37px; | ||
} | ||
.section-item { | ||
font-size: 20px; | ||
text-align: center; | ||
} | ||
} |
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.
👍 Great attention to detail