Feat: start working on dragndrop

This commit is contained in:
2025-01-08 17:16:33 +03:00
parent 4c8bcf07b3
commit a74b499d83
4 changed files with 44 additions and 12 deletions

View File

@@ -1,14 +1,23 @@
import { tierImage } from '../store';
interface ImageProps {
image: string;
name: string;
image: tierImage;
onDragStart?: () => void;
}
export const TierImage = ({ image, name }: ImageProps) => {
export const TierImage = ({ image, onDragStart }: ImageProps) => {
return (
<div className='flex flex-wrap justify-center gap-4 mr-1'>
<div
className='flex flex-wrap justify-center gap-4 mr-1'
onDragStart={() => {
// e.preventDefault();
if (onDragStart) onDragStart();
}}
>
<div className={`w-[calc(20rem*.5625)] h-80 relative`}>
<img src={image} alt={name} className='h-full w-full object-cover' />
<div className='w-full bg-slate-500 text-white bg-opacity-70 text-center bottom-0 left-0 absolute'>{name}</div>
<img src={image.url} alt={image.name} className='h-full w-full object-cover' />
<div className='w-full bg-slate-500 text-white bg-opacity-70 text-center bottom-0 left-0 absolute'>
{image.name}
</div>
</div>
</div>
);