diff --git a/src/components/App.jsx b/src/components/App.jsx index 7055d21..ac144ca 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -1,7 +1,7 @@ import { Route, Routes } from "react-router-dom"; import { lazy } from "react"; import { Layout } from "./Layout/Layout"; -import css from './App.module.css'; +//import css from './App.module.css'; //import Home from "pages/Home/Home"; //import MovieDetails from "pages/MovieDetails/MovieDetails"; //import Movies from "pages/Movies/Movies"; @@ -18,6 +18,7 @@ const Cast = lazy(() => ...module, default: module.Cast, }))); +const NotFoundPage = lazy(()=> import("../pages/NotFound/NotFound")); export const App = () => { @@ -35,7 +36,8 @@ export const App = () => { } /> - Ooooops, page not found} /> + {/* Ooooops, page not found} /> */} + } /> ) diff --git a/src/pages/Home/Home.jsx b/src/pages/Home/Home.jsx index cbd4f03..f34a73f 100644 --- a/src/pages/Home/Home.jsx +++ b/src/pages/Home/Home.jsx @@ -10,10 +10,10 @@ const Home = () => { fetchTrendingMovies().then(response => setMovies(response)) }, []); - return + return Trending today - + }; export default Home; diff --git a/src/pages/MovieDetails/MovieDetails.jsx b/src/pages/MovieDetails/MovieDetails.jsx index 8aa70d3..54ac84b 100644 --- a/src/pages/MovieDetails/MovieDetails.jsx +++ b/src/pages/MovieDetails/MovieDetails.jsx @@ -27,7 +27,7 @@ const MovieDetails = () => { }, [movieId]); return ( - + {' '} Go back @@ -80,7 +80,7 @@ const MovieDetails = () => { }> - + ); }; diff --git a/src/pages/Movies/Movies.jsx b/src/pages/Movies/Movies.jsx index ca73a21..e35cecd 100644 --- a/src/pages/Movies/Movies.jsx +++ b/src/pages/Movies/Movies.jsx @@ -42,10 +42,10 @@ import css from './Movies.module.css'; }, [query]); return ( - + {movies.length > 0 && } - + ); }; diff --git a/src/pages/NotFound/NotFound.jsx b/src/pages/NotFound/NotFound.jsx new file mode 100644 index 0000000..63c1d2a --- /dev/null +++ b/src/pages/NotFound/NotFound.jsx @@ -0,0 +1,25 @@ +import React, { useRef } from 'react'; +import css from './NotFound.module.css'; +import { Link, useLocation } from 'react-router-dom'; + +const NotFoundPage = () => { + const location = useLocation(); + const backLinkLocationRef = useRef(location.state?.from ?? './movies'); + + return ( + + + 404 Not Found + + Oops! The page you are looking for might be in another castle. + + + {' '} + Go to search + + + + ); +}; + +export default NotFoundPage; diff --git a/src/pages/NotFound/NotFound.module.css b/src/pages/NotFound/NotFound.module.css new file mode 100644 index 0000000..2aeb30e --- /dev/null +++ b/src/pages/NotFound/NotFound.module.css @@ -0,0 +1,26 @@ +.page { + background-color: #f4f4f4; + margin: 0; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; +} + +.container { + text-align: center; +} + +.not__title { + font-size: 3em; + color: #333; + margin-bottom: 20px; +} + +.not__text { + font-size: 1.5em; + color: #555; + margin-bottom: 30px; +} + +
+ Oops! The page you are looking for might be in another castle. +