text fix + image fade in
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { AutoTextSize } from "auto-text-size";
|
||||
import Image from "next/image";
|
||||
import Image from "@/components/image";
|
||||
import type { characters } from "@/lib/db/schema";
|
||||
|
||||
// TODO: Change amber type
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import NextImage from "next/image";
|
||||
import { useState } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export default function Image({
|
||||
src,
|
||||
alt,
|
||||
className = "",
|
||||
...props
|
||||
}: React.ComponentProps<typeof NextImage>) {
|
||||
const [isLoaded, setIsLoaded] = useState(false);
|
||||
|
||||
return (
|
||||
<NextImage
|
||||
src={src}
|
||||
alt={alt}
|
||||
className={cn(
|
||||
"transition-opacity duration-700 opacity-0",
|
||||
isLoaded && "opacity-100",
|
||||
className,
|
||||
)}
|
||||
onLoad={() => setIsLoaded(true)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user