feature - added darkmode background
This commit is contained in:
parent
477a847332
commit
92c1769619
|
@ -1,6 +1,4 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import colors, { hexToRgb } from "@/utils/colors";
|
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
import React, { ReactNode, useEffect, useState } from "react";
|
import React, { ReactNode, useEffect, useState } from "react";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
@ -13,28 +11,13 @@ const Background = ({
|
||||||
className?: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
const [mounted, setMounted] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setMounted(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (!mounted) {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={"h-full relative w-full bg-center bg-no-repeat bg-cover bg-fixed min-h-screen flex flex-col animation-pulse " + className}
|
|
||||||
></div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const backgroundColor = hexToRgb(colors[theme!]["neutral"]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={"h-full relative w-full bg-center bg-no-repeat bg-cover bg-fixed flex flex-col " + className}
|
className={"h-full relative w-full bg-center bg-no-repeat bg-cover bg-fixed flex flex-col " + className}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
src="/images/gradient.webp"
|
src={theme == "dark" ? "/images/dark-gradient.webp" : "/images/gradient.webp"}
|
||||||
alt="background"
|
alt="background"
|
||||||
layout="fill"
|
layout="fill"
|
||||||
objectFit="cover"
|
objectFit="cover"
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
|
@ -278,7 +278,7 @@ const SquaredBackgroundHero = () => {
|
||||||
src="/images/fastpocket-diagram_352x316.webp"
|
src="/images/fastpocket-diagram_352x316.webp"
|
||||||
alt="Image Description"
|
alt="Image Description"
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-0 -z-[1] bg-gradient-to-tr from-gray-200 via-white/0 to-white/0 size-full rounded-md mt-4 -mb-4 me-4 -ms-4 lg:mt-6 lg:-mb-6 lg:me-6 lg:-ms-6 dark:from-slate-800 dark:via-slate-900/0 dark:to-slate-900/0" />
|
<div className="absolute inset-0 -z-[1] size-full rounded-md mt-4 -mb-4 me-4 -ms-4 lg:mt-6 lg:-mb-6 lg:me-6 lg:-ms-6" />
|
||||||
</div>
|
</div>
|
||||||
{/* End Col */}
|
{/* End Col */}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue