2024-02-28 21:02:05 +03:00
|
|
|
import React, { type FC } from 'react';
|
2024-01-31 04:25:14 +03:00
|
|
|
import layoutManager from 'components/layoutManager';
|
|
|
|
|
|
|
|
import CardOverlayButtons from './CardOverlayButtons';
|
|
|
|
import CardHoverMenu from './CardHoverMenu';
|
|
|
|
import CardOuterFooter from './CardOuterFooter';
|
|
|
|
import CardContent from './CardContent';
|
2024-02-28 22:47:36 +03:00
|
|
|
import { CardShape } from 'utils/card';
|
2024-08-21 03:27:03 +03:00
|
|
|
|
2024-03-03 01:31:35 +03:00
|
|
|
import type { ItemDto } from 'types/base/models/item-dto';
|
2024-01-31 04:25:14 +03:00
|
|
|
import type { CardOptions } from 'types/cardOptions';
|
|
|
|
|
|
|
|
interface CardBoxProps {
|
2024-08-21 20:08:43 +03:00
|
|
|
action: string;
|
2024-01-31 04:25:14 +03:00
|
|
|
item: ItemDto;
|
|
|
|
cardOptions: CardOptions;
|
|
|
|
className: string;
|
2024-02-28 22:47:36 +03:00
|
|
|
shape: CardShape | undefined;
|
2024-01-31 04:25:14 +03:00
|
|
|
imgUrl: string | undefined;
|
|
|
|
blurhash: string | undefined;
|
|
|
|
forceName: boolean;
|
|
|
|
coveredImage: boolean;
|
|
|
|
overlayText: boolean | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
const CardBox: FC<CardBoxProps> = ({
|
2024-08-21 20:08:43 +03:00
|
|
|
action,
|
2024-01-31 04:25:14 +03:00
|
|
|
item,
|
|
|
|
cardOptions,
|
|
|
|
className,
|
|
|
|
shape,
|
|
|
|
imgUrl,
|
|
|
|
blurhash,
|
|
|
|
forceName,
|
|
|
|
coveredImage,
|
|
|
|
overlayText
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<div className={className}>
|
|
|
|
<div className='cardScalable'>
|
|
|
|
<div className={`cardPadder cardPadder-${shape}`}></div>
|
|
|
|
<CardContent
|
|
|
|
item={item}
|
|
|
|
cardOptions={cardOptions}
|
|
|
|
coveredImage={coveredImage}
|
|
|
|
|
|
|
|
overlayText={overlayText}
|
|
|
|
imgUrl={imgUrl}
|
|
|
|
blurhash={blurhash}
|
|
|
|
forceName={forceName}
|
|
|
|
/>
|
|
|
|
{layoutManager.mobile && (
|
|
|
|
<CardOverlayButtons
|
|
|
|
item={item}
|
|
|
|
cardOptions={cardOptions}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{layoutManager.desktop
|
|
|
|
&& !cardOptions.disableHoverMenu && (
|
|
|
|
<CardHoverMenu
|
2024-08-21 20:08:43 +03:00
|
|
|
action={action}
|
2024-01-31 04:25:14 +03:00
|
|
|
item={item}
|
|
|
|
cardOptions={cardOptions}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
{!overlayText && (
|
|
|
|
<CardOuterFooter
|
|
|
|
item={item}
|
|
|
|
cardOptions={cardOptions}
|
|
|
|
forceName={forceName}
|
|
|
|
overlayText={overlayText}
|
|
|
|
imgUrl={imgUrl}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default CardBox;
|
|
|
|
|