StephDietz 2f7569ce41 merge
2023-07-12 10:47:43 -05:00

59 lines
1.4 KiB
TypeScript

import clsx from 'clsx';
import Image from 'next/image';
import Label from '../label';
export function GridTileImage({
isInteractive = true,
active,
labelPosition,
labels,
...props
}: {
isInteractive?: boolean;
active?: boolean;
labelPosition?: 'bottom' | 'center';
labels?: {
title: string;
amount: string;
currencyCode: string;
isSmall?: boolean;
};
} & React.ComponentProps<typeof Image>) {
return (
<div
className={clsx(
'relative flex h-full w-full items-center justify-center overflow-hidden rounded-lg border bg-white dark:bg-black',
active !== undefined && active
? 'border-2 border-blue-600'
: 'border-gray-200 dark:border-gray-800',
{
relative: labels
}
)}
>
{props.src ? (
<Image
className={clsx('relative h-full w-full object-contain', {
'transition duration-300 ease-in-out hover:scale-105': isInteractive
})}
{...props}
alt={props.title || ''}
/>
) : null}
{labels ? (
<Label
title={labels.title}
amount={labels.amount}
currencyCode={labels.currencyCode}
<<<<<<< HEAD
size={labels.isSmall ? 'small' : 'large'}
=======
size="large"
>>>>>>> design-refresh
position={labelPosition}
/>
) : null}
</div>
);
}