Aurora Background
Preview
Content on Aurora
Code
"use client";
import { cn } from "@/lib/utils";
import { type FC, type ReactNode } from "react";
interface AuroraBackgroundProps extends React.HTMLProps<HTMLDivElement> {
children: ReactNode;
className?: string;
}
const AuroraBackground: FC<AuroraBackgroundProps> = ({
className,
children,
...props
}) => {
return (
<main>
<div
className={cn(
"relative flex flex-col h-full items-center justify-center bg-black text-slate-50 transition-bg",
className
)}
{...props}
>
<div className="absolute inset-0 overflow-hidden">
<div
className={cn(
`
[--white-gradient:repeating-linear-gradient(100deg,var(--white)_0%,var(--white)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--white)_16%)]
[--dark-gradient:repeating-linear-gradient(100deg,var(--black)_0%,var(--black)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--black)_16%)]
[--aurora:repeating-linear-gradient(100deg,var(--blue-500)_10%,var(--indigo-300)_15%,var(--blue-300)_20%,var(--violet-200)_25%,var(--blue-400)_30%)]
[background-image:var(--white-gradient),var(--aurora)]
dark:[background-image:var(--dark-gradient),var(--aurora)]
[background-size:300%,_200%]
[background-position:50%_50%,50%_50%]
filter_invert_0_dark:invert
after:content-[""] after:absolute after:inset-0 after:[background-image:var(--white-gradient),var(--aurora)]
after:dark:[background-image:var(--dark-gradient),var(--aurora)]
after:[background-size:200%,_100%]
after:animate-aurora after:[background-attachment:fixed] after:mix-blend-difference
pointer-events-none
absolute -inset-[10px] opacity-50 will-change-transform`,
)}
></div>
</div>
<div className="relative z-10">{children}</div>
</div>
</main>
);
};
export default AuroraBackground;