Skip to content

Commit

Permalink
Merge pull request #78 from Dreallers/pop_up_add
Browse files Browse the repository at this point in the history
Pop up add
  • Loading branch information
Tony97421 authored Jan 25, 2024
2 parents 378d897 + 006c2f1 commit c90f81c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 198 deletions.
Binary file added frontend/src/assets/icons/pub_spotify.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions frontend/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import DynamicHeroSlider from "../components/DynamicHeroSlider";
import CategoryDisplay from "../components/CategoryDisplay";
import MovieGenreTabsContainer from "../components/MovieGenreTabsContainer";
import LogoContainer from "../components/LogoContainer";
import { useUser } from "../contexts/UserContext";

function Home() {
const { movies } = useMovies();
const [categories, setCategories] = useState([]);
const { user } = useUser();
const [showAd, setShowAd] = useState(false);

const getCategories = () => {
axios
Expand All @@ -25,11 +28,28 @@ function Home() {
getCategories();
}, []);

useEffect(() => {
setShowAd(true);
const timer = setTimeout(() => {
setShowAd(false);
}, 6000);
return () => clearTimeout(timer);
}, []);

return (
<div className="home">
<div className="movies-display-section">
<LogoContainer />
<DynamicHeroSlider movies={movies} />
<button
type="button"
className={`pub ${showAd ? "show" : "hide"}`}
onClick={() =>
window.open("https://open.spotify.com/intl-fr", "_blank")
}
>
{!user && <img src="/src/assets/icons/pub_spotify.jpg" alt="pub" />}
</button>
<MovieGenreTabsContainer categories={categories} />
{categories.map((categorie) => (
<CategoryDisplay
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/sass/_home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@
calc(var(--spacing-constant) * 2 * 1.5)
);
display: flex;
.pub {
border: none;
position: fixed;
right: 0;
z-index: 9999;
top: 50%;
transform: translateX(100%);
transition: transform 1s ease-in-out;
width: 80%;
max-width: 800px;
img {
width: 100%;
height: auto;
}
&.show {
transform: translateX(0);
}
&.hide {
transform: translateX(100%);
}
}
}
}

Expand Down
198 changes: 0 additions & 198 deletions frontend/src/sass/_serie.scss

This file was deleted.

0 comments on commit c90f81c

Please sign in to comment.