2023-08-13 17:14:30 +09:00

36 lines
921 B
TypeScript

import clsx from 'clsx';
import Image from 'next/image';
import Label from '../label';
export function GridTileImage({
isInteractive = true,
active,
label,
...props
}: {
isInteractive?: boolean;
active?: boolean;
label?: {
title: string;
amount: string;
currencyCode: string;
};
} & React.ComponentProps<typeof Image>) {
return (
<div className="flex flex-col space-y-2">
{props.src ? (
// eslint-disable-next-line jsx-a11y/alt-text -- `alt` is inherited from `props`, which is being enforced with TypeScript
<Image
className={clsx('h-full w-full object-contain', {
'transition duration-300 ease-in-out hover:scale-105': isInteractive
})}
{...props}
/>
) : null}
{label ? (
<Label title={label.title} amount={label.amount} currencyCode={label.currencyCode} />
) : null}
</div>
);
}