Simplify StillImage component, fix header images

This commit is contained in:
Alex Gleason 2022-11-22 11:33:47 -06:00
parent dce26a6600
commit 47613dde56
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
4 changed files with 25 additions and 32 deletions

View file

@ -47,35 +47,33 @@ const StillImage: React.FC<IStillImage> = ({ alt, className, src, style, letterb
return ( return (
<div <div
data-testid='still-image-container' data-testid='still-image-container'
className={classNames(className, 'group overflow-hidden isolate')} className={classNames(className, 'relative group overflow-hidden isolate')}
style={style} style={style}
> >
<div className='relative w-full h-full'> <img
<img src={src}
src={src} alt={alt}
alt={alt} ref={img}
ref={img} onLoad={handleImageLoad}
onLoad={handleImageLoad} className={classNames(baseClassName, {
'invisible group-hover:visible': hoverToPlay,
})}
/>
{hoverToPlay && (
<canvas
ref={canvas}
className={classNames(baseClassName, { className={classNames(baseClassName, {
'absolute invisible group-hover:visible': hoverToPlay, 'group-hover:invisible': hoverToPlay,
})} })}
/> />
)}
{hoverToPlay && ( {(hoverToPlay && showExt) && (
<canvas <div className='group-hover:hidden absolute opacity-90 left-2 bottom-2 pointer-events-none'>
ref={canvas} <ExtensionBadge ext='GIF' />
className={classNames(baseClassName, { </div>
'group-hover:invisible': hoverToPlay, )}
})}
/>
)}
{(hoverToPlay && showExt) && (
<div className='group-hover:hidden absolute opacity-90 left-2 bottom-2 pointer-events-none'>
<ExtensionBadge ext='GIF' />
</div>
)}
</div>
</div> </div>
); );
}; };

View file

@ -33,7 +33,7 @@ const Card = React.forwardRef<HTMLDivElement, ICard>(({ children, variant = 'def
ref={ref} ref={ref}
{...filteredProps} {...filteredProps}
className={classNames({ className={classNames({
'bg-white dark:bg-primary-900 text-gray-900 dark:text-gray-100 shadow-lg dark:shadow-none overflow-hidden': variant === 'rounded', 'bg-white dark:bg-primary-900 text-gray-900 dark:text-gray-100 shadow-lg dark:shadow-none overflow-hidden isolate': variant === 'rounded',
[sizes[size]]: variant === 'rounded', [sizes[size]]: variant === 'rounded',
}, className)} }, className)}
> >

View file

@ -551,13 +551,12 @@ const Header: React.FC<IHeader> = ({ account }) => {
)} )}
<div> <div>
<div className='relative h-32 w-full lg:h-48 md:rounded-t-xl bg-gray-200 dark:bg-gray-900/50'> <div className='relative flex flex-col justify-center h-32 w-full lg:h-48 md:rounded-t-xl bg-gray-200 dark:bg-gray-900/50 overflow-hidden isolate'>
{account.header && ( {account.header && (
<a href={account.header} onClick={handleHeaderClick} target='_blank'> <a href={account.header} onClick={handleHeaderClick} target='_blank'>
<StillImage <StillImage
src={account.header} src={account.header}
alt='Profile Header' alt='Profile Header'
className='absolute inset-0 object-cover md:rounded-t-xl'
/> />
</a> </a>
)} )}

View file

@ -36,13 +36,9 @@ const UserPanel: React.FC<IUserPanel> = ({ accountId, action, badges, domain })
<div className='relative'> <div className='relative'>
<Stack space={2}> <Stack space={2}>
<Stack> <Stack>
<div className='-mt-4 -mx-4 h-24 bg-gray-200 relative'> <div className='-mt-4 -mx-4 h-24 bg-gray-200 relative overflow-hidden'>
{header && ( {header && (
<StillImage <StillImage src={account.header} />
src={account.get('header')}
className='absolute inset-0 object-cover'
alt=''
/>
)} )}
</div> </div>