feat: support kind 20

This commit is contained in:
codytseng
2025-01-07 23:19:35 +08:00
parent 4205e32d0f
commit 4343765aba
30 changed files with 1221 additions and 712 deletions

View File

@@ -0,0 +1,35 @@
import { Skeleton } from '@/components/ui/skeleton'
import { cn } from '@/lib/utils'
import { HTMLAttributes, useState } from 'react'
export default function Image({
src,
alt,
className = '',
classNames = {},
...props
}: HTMLAttributes<HTMLDivElement> & {
src: string
alt?: string
classNames?: {
wrapper?: string
}
}) {
const [isLoading, setIsLoading] = useState(true)
return (
<div className={cn('relative', classNames.wrapper ?? '')} {...props}>
{isLoading && <Skeleton className={cn('absolute inset-0', className)} />}
<img
src={src}
alt={alt}
className={cn(
'object-cover transition-opacity duration-700',
isLoading ? 'opacity-0' : 'opacity-100',
className
)}
onLoad={() => setIsLoading(false)}
/>
</div>
)
}