Skip to content

Commit

Permalink
updated semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjenm committed Apr 23, 2023
1 parent 5bfdbba commit 977424d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
23 changes: 7 additions & 16 deletions src/js/movie-gallery.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import {
fetchTrendingMovies,
getMovieInfo,
getSearchMovies,
hideLoadingAnimationWithDelay,
showLoadingAnimation,
} from './API-requests.js';
import genreList from './genre-list.js';
import { createPagination } from '../index.js';
import {
movieGalleryPosterDimension,
MOVIE__POSTERS__URL,
updateMovieGalleryPosterDimension,
updateMoviePosterUrl,
} from './movie-poster-data.js';
Expand Down Expand Up @@ -100,21 +97,15 @@ export async function renderInfo(movies) {
movieList.innerHTML = '';

movies.map(movie => {
const card = document.createElement('div');
const card = document.createElement('ul');
card.setAttribute('data', movie.id);
card.classList.add('movie-card');
card.innerHTML = `${moviePosterFn(movie)}
<ul class="movie_info">
<li class="movie_title">
${movie.title}
</li>
<li class="movie_genre">
${getGenres(genreList, movie.genre_ids)}
</li>
<li class="movie_release-date">
${new Date(movie.release_date).getFullYear()}
</li>
</ul>`;
card.innerHTML = `
<li class="movie_info">${moviePosterFn(movie)}
<p class="movie_title">${movie.title}</p>
<span class="movie_genre">${getGenres(genreList, movie.genre_ids)}</span>
<span class="movie_release-date">${new Date(movie.release_date).getFullYear()}</span>
</li>`;
movieList.appendChild(card);
});
hideLoadingAnimationWithDelay(500);
Expand Down
4 changes: 2 additions & 2 deletions src/js/movie-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let checkArrary = -1;
let checkclass;
movieGallery.addEventListener('click', e => {
//get movie id
const parent = e.target.closest('div');
const parent = e.target.closest('ul');
const movieId = parent.getAttribute('data');
mylibID = movieId;
// show modal after html is rendered. Image is rendering after
Expand All @@ -39,7 +39,7 @@ movieGallery.addEventListener('click', e => {
myLibaryGallery.addEventListener('click', e => {
//get movie id

console.log('image clicked')
// console.log('image clicked')
const parent = e.target.closest('div');
const movieId = parent.getAttribute('data');
mylibID = movieId;
Expand Down
4 changes: 2 additions & 2 deletions src/partials/card-gallery.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<div class="card-gallery">
</div>
<section class="card-gallery">
</section>

0 comments on commit 977424d

Please sign in to comment.