import { Box, ChakraProps, Flex, Heading, Image } from '@chakra-ui/react'; import { memo } from 'react'; import { TypesafeDraggableData } from './typesafeDnd'; type OverlayDragImageProps = { dragData: TypesafeDraggableData | null; }; const BOX_SIZE = 28; const STYLES: ChakraProps['sx'] = { w: BOX_SIZE, h: BOX_SIZE, maxW: BOX_SIZE, maxH: BOX_SIZE, shadow: 'dark-lg', borderRadius: 'lg', borderWidth: 2, borderStyle: 'dashed', borderColor: 'base.100', opacity: 0.5, bg: 'base.800', color: 'base.50', _dark: { borderColor: 'base.200', bg: 'base.900', color: 'base.100', }, }; const DragPreview = (props: OverlayDragImageProps) => { if (!props.dragData) { return; } if (props.dragData.payloadType === 'IMAGE_DTO') { return ( ); } if (props.dragData.payloadType === 'IMAGE_NAMES') { return ( {props.dragData.payload.imageNames.length} Images ); } return null; }; export default memo(DragPreview);