Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x | // Icons
import { CloseIcon } from '../icons/reacts';
// UI
import { ImageFallback } from '../common';
// Utils
import { combineClasses } from '@shared/utils';
export const ImagePreview = ({
previewUrl,
onRemove,
}: {
previewUrl: string;
onRemove: () => void;
}) => (
<div className="ml-3.5 mt-2.5 relative overflow-hidden rounded-md w-[50px] h-[50px] group border border-frost-250/40">
<div
className={combineClasses(
'absolute top-0 right-0 bg-black/25 z-10 h-full',
'w-full rounded-md flex items-start justify-start opacity-0 group-hover:opacity-100 transition',
)}
>
<button
onClick={onRemove}
className="m-1 size-4 flex items-center justify-center bg-black/80 rounded-full text-white hover:bg-black"
>
<CloseIcon className="w-2 h-2" />
</button>
</div>
<ImageFallback
src={previewUrl}
alt="Avatar preview"
width={50}
height={50}
className="object-contain w-full h-full rounded-md"
/>
</div>
);
|