Skip to content
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

Pop up add #78

Merged
merged 6 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading