Skip to content

Commit

Permalink
reduce background jumping
Browse files Browse the repository at this point in the history
  • Loading branch information
nibty committed May 22, 2024
1 parent c359db5 commit ee2766b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export default function Footer() {
export default function Footer({ isLoading = false }: { isLoading?: boolean }) {
return (
<footer className="footer footer-center z-[2] mt-auto p-5 text-accent-content drop-shadow-xl shadow-xl bg-accent text-gray-700">
<footer
className={`footer footer-center z-[2] mt-auto p-5 text-accent-content drop-shadow-xl shadow-xl bg-accent text-gray-700 opacity-0 ${!isLoading && "fade-in"}`}
>
<aside>
<p className="font-bold">solXEN</p>
<p>Copyright © 2024 - All right reserved</p>
Expand Down
5 changes: 5 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ body {
transition: opacity 0.3s ease-in-out;
}

.fade-in-fast {
opacity: 1;
transition: opacity 0.1s ease-in-out;
}

.fade-out {
opacity: 0;
transition: opacity 0.1s ease-in-out;
Expand Down
1 change: 1 addition & 0 deletions app/leaderboard/Background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function Background({ isLoading }: BackgroundProps) {
className="fixed h-full w-full left-0 top-0"
>
<Image
className={`opacity-0 ${!isLoading && "fade-in-fast"}`}
alt="Background image"
src="/background-image.jpg"
fill
Expand Down
3 changes: 2 additions & 1 deletion app/leaderboard/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export default function LeaderboardSlug({
/>
</>
)}
{!isLoading && <Footer />}

<Footer isLoading={isLoading} />
</main>
);
}
2 changes: 1 addition & 1 deletion app/leaderboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function Leaderboard() {
</div>
</div>

{!isLoading && <Footer />}
<Footer isLoading={isLoading} />
</main>
);
}

0 comments on commit ee2766b

Please sign in to comment.