import * as Headless from '@headlessui/react' import clsx from 'clsx' import React, { forwardRef } from 'react' import { TouchTarget } from './button' import { Link } from './link' type AvatarProps = { src?: string | null square?: boolean initials?: string alt?: string className?: string } export function Avatar({ src = null, square = false, initials, alt = '', className, ...props }: AvatarProps & React.ComponentPropsWithoutRef<'span'>) { return ( {initials && ( {alt && {alt}} {initials} )} {src && {alt}} ) } export const AvatarButton = forwardRef(function AvatarButton( { src, square = false, initials, alt, className, ...props }: AvatarProps & (Omit | Omit, 'className'>), ref: React.ForwardedRef ) { let classes = clsx( className, square ? 'rounded-[20%]' : 'rounded-full', 'relative inline-grid focus:outline-none data-[focus]:outline data-[focus]:outline-2 data-[focus]:outline-offset-2 data-[focus]:outline-blue-500' ) return 'href' in props ? ( }> ) : ( ) })