Skip to content

Commit

Permalink
refactor + webp background
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekg999 committed Oct 20, 2024
1 parent 697289a commit 7cf1418
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Binary file added public/min/background-min.webp
Binary file not shown.
8 changes: 1 addition & 7 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ export function App() {
<>
<div className="flex flex-col min-h-[100dvh] relative">
<Background />
<div className="absolute inset-0 z-0 pointer-events-none">
{/** Very light gradients overlaying the image */}
<div className="absolute inset-0 bg-gradient-to-b from-transparent to-[#1a2e1a] z-10 opacity-0"></div>
<div className="absolute inset-0 bg-gradient-to-t from-transparent to-[#1a2e1a] z-10 opacity-0"></div>
<div className="absolute inset-0 bg-gradient-to-r from-transparent to-[#1a2e1a] z-10 opacity-20"></div>
<div className="absolute inset-0 bg-gradient-to-l from-transparent to-[#1a2e1a] z-10 opacity-20"></div>
</div>

<LocationProvider>
<Navbar />
<Router>
Expand Down
14 changes: 10 additions & 4 deletions src/components/Background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ export function Background() {

// TODO: maybe have some loading screen while the image loads...
return (
<>
<div className="absolute inset-0 z-0 pointer-events-none">
{/** Very light gradients overlaying the image */}
<div className="absolute inset-0 bg-gradient-to-b from-transparent to-[#1a2e1a] z-10 opacity-0"></div>
<div className="absolute inset-0 bg-gradient-to-t from-transparent to-[#1a2e1a] z-10 opacity-0"></div>
<div className="absolute inset-0 bg-gradient-to-r from-transparent to-[#1a2e1a] z-10 opacity-20"></div>
<div className="absolute inset-0 bg-gradient-to-l from-transparent to-[#1a2e1a] z-10 opacity-20"></div>

{/** Background image, always full size */}
<img
src="/min/background-min.jpg"
src="/min/background-min.webp"
className="w-full h-full fixed inset-0 object-cover object-right-top opacity-40 z-[-1]"
alt=""
onLoad={() => setLoaded(true)}
/>
</>
</div>
)
}
}

0 comments on commit 7cf1418

Please sign in to comment.