-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
366 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,52 @@ | ||
"use client"; | ||
|
||
import Image from "next/image"; | ||
import { useTheme } from "@/contexts/theme/ThemeContext"; | ||
import { useState } from "react"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
export function BackgroundImage() { | ||
const { theme } = useTheme(); | ||
const [isLoading, setIsLoading] = useState(true); | ||
|
||
const handleImageLoad = () => { | ||
setIsLoading(false); | ||
}; | ||
|
||
return ( | ||
<div className="fixed inset-0 w-full h-full"> | ||
<div className="absolute inset-0 bg-background dark:hidden"> | ||
<div | ||
className={cn( | ||
"absolute inset-0 transition-opacity duration-1000", | ||
isLoading ? "opacity-0" : "opacity-100" | ||
)} | ||
> | ||
<Image | ||
src="/images/background-color.webp" | ||
alt="Background" | ||
src={theme === 'dark' | ||
? "/images/background-color-dark.webp" | ||
: "/images/background-color.webp" | ||
} | ||
alt="" | ||
fill | ||
priority | ||
quality={40} | ||
sizes="100vw" | ||
quality={60} | ||
className="object-cover" | ||
/> | ||
</div> | ||
<div className="absolute inset-0 bg-background hidden dark:block"> | ||
<Image | ||
src="/images/background-color-dark.webp" | ||
alt="Background Dark" | ||
fill | ||
priority | ||
sizes="100vw" | ||
quality={60} | ||
className="object-cover" | ||
className={cn( | ||
"object-cover", | ||
"transition-transform duration-[2s]", | ||
"scale-[1.02]", | ||
isLoading ? "blur-xl" : "blur-0" | ||
)} | ||
onLoad={handleImageLoad} | ||
/> | ||
</div> | ||
|
||
<div | ||
className={cn( | ||
"absolute inset-0 bg-gradient-to-b from-background to-background/80", | ||
"transition-opacity duration-1000", | ||
isLoading ? "opacity-100" : "opacity-0" | ||
)} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.