Skip to content

Commit

Permalink
"shimmer effect"
Browse files Browse the repository at this point in the history
  • Loading branch information
UKS28 committed Apr 7, 2024
1 parent 78a29a3 commit 1e65f58
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
- asking user api key

# To Do:
- responsive(*)
- responsive(*)
- each card functionality ✔
- shimmer UI (*)
- shimmer UI (*)
- Error Handling ✔
- test user already present ✔
- gpt page css
Expand Down
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"react-dom": "^18.2.0",
"react-redux": "^9.1.0",
"react-scripts": "5.0.1",
"react-shimmer-effects": "^1.0.3",
"swiper": "^11.0.6"
},
"scripts": {
Expand Down
4 changes: 0 additions & 4 deletions src/components/ContentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ import React, { useEffect } from 'react'
import { useParams } from 'react-router-dom'
import DetailedContent from './DetailedContent';
import SimilarContent from './SimilarContent';
import { MOVIE_API_OPTION } from '../utils/constant';
import { useDispatch } from 'react-redux'
import { addSimilarMovie } from '../utils/movieSlice';
import useSimilarMovie from '../customHook/useSimilarMovie';
import useRecommendedMovies from '../customHook/useRecommendedMovies';
import Header from './Header';

const ContentPage = () => {
const {id}=useParams();
Expand Down
4 changes: 4 additions & 0 deletions src/components/Secondarycotainer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { useSelector } from "react-redux";
import Movielist from "./Movielist";
import Shimmer from "./Shimmer";

const Secondarycontainer=()=>{
const movie=useSelector(store=>store.movie)
// console.log(movie.nowPlayingMovies)
if(movie.nowPlayingMovies===null)
return <Shimmer/>

return (
movie.nowPlayingMovies &&
( <div className="bg-black w-screen aspect-video">
Expand Down
7 changes: 7 additions & 0 deletions src/components/Shimmer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ShimmerSimpleGallery } from "react-shimmer-effects";

const Shimmer = () => {
return <ShimmerSimpleGallery card imageHeight={300} />;
};

export default Shimmer;
2 changes: 1 addition & 1 deletion src/customHook/useNowPlayingMovies.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useNowPlayingMovies=()=>{
const getMovies=async ()=>{
const data =await fetch('https://api.themoviedb.org/3/movie/now_playing?page=1', MOVIE_API_OPTION)
const json=await data.json();
// console.log(json.results)
// console.log(json.results)
dispatch(addNowPlayingMovie(json.results));
}

Expand Down
4 changes: 2 additions & 2 deletions src/customHook/usePopularMovie.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const usePopularMovie=()=>{

const getPopularMovie=async()=>{
const data=await fetch('https://api.themoviedb.org/3/movie/popular?language=en-US&page=1', MOVIE_API_OPTION);
const json =await data.json();
// console.log(json.results);
const json =await data.json();
// console.log(json.results);
dispatch(addPopular(json.results));

}
Expand Down
23 changes: 7 additions & 16 deletions src/utils/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,13 @@ export const AVATAR=
export const NETFLIX_BG=
"https://assets.nflxext.com/ffe/siteui/vlv3/c0b69670-89a3-48ca-877f-45ba7a60c16f/2642e08e-4202-490e-8e93-aff04881ee8a/IN-en-20240212-popsignuptwoweeks-perspective_alpha_website_large.jpg";

// export const MOVIE_API_OPTION = {
// method: 'GET',
// headers: {
// accept: 'application/json',
// Authorization: process.env.TMDB_API,
// }
// };

export const MOVIE_API_OPTION ={
method: 'GET',
headers: {
accept: 'application/json',
Authorization: process.env.TMDB_API,

}
};
export const MOVIE_API_OPTION = {
method: 'GET',
headers: {
accept: 'application/json',
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJlNDBkMzYzMTFlY2NmYWUxNDQ2ZDg3ZmVmNDkzZThhYSIsInN1YiI6IjY1ZDMxZjM5NGJjMzhiMDE4OTU1MzA2ZSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.Mgj7uyWAiE27gA0u1LpwiEdnUnl7dEmi3pIs-24jAGY',
}
};

export const POSTER_PATH_CDN=
"https://image.tmdb.org/t/p/original";
Expand Down

0 comments on commit 1e65f58

Please sign in to comment.