Avatar

components/Avatar.tsx
import { ClassValue } from 'clsx'
import { cn } from '@/lib/utils'
export default function Avatar({
className,
imageUrl,
}: {
className?: ClassValue
imageUrl: string
}) {
return (
<div
style={{
backgroundImage: `url(${imageUrl})`,
}}
className={cn(
'h-16 w-16 rounded-full border-2 border-border dark:border-darkBorder bg-cover bg-center',
className,
)}
></div>
)
}

Usage

import Avatar from '@/components/Avatar'

<Avatar imageUrl="https://hips.hearstapps.com/hmg-prod/images/flowers-trees-and-bushes-reach-their-peak-of-full-bloom-in-news-photo-1678292967.jpg?crop=0.668xw:1.00xh;0.0726xw,0&resize=64:*" />
Edit this page