forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageUploadQueue.tsx
More file actions
77 lines (74 loc) · 1.97 KB
/
Copy pathImageUploadQueue.tsx
File metadata and controls
77 lines (74 loc) · 1.97 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from "react";
interface ImageUploadQueueProps {
images: Array<{ contentType: string; bytes: string }>;
onRemoveImage: (index: number) => void;
className?: string;
}
export const ImageUploadQueue: React.FC<ImageUploadQueueProps> = ({
images,
onRemoveImage,
className = "",
}) => {
if (images.length === 0) return null;
return (
<div
className={`copilotKitImageUploadQueue ${className}`}
style={{
display: "flex",
flexWrap: "wrap",
gap: "8px",
margin: "8px",
padding: "8px",
}}
>
{images.map((image, index) => (
<div
key={index}
className="copilotKitImageUploadQueueItem"
style={{
position: "relative",
display: "inline-block",
width: "60px",
height: "60px",
borderRadius: "4px",
overflow: "hidden",
}}
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={`data:${image.contentType};base64,${image.bytes}`}
alt={`Selected image ${index + 1}`}
style={{
width: "100%",
height: "100%",
objectFit: "cover",
}}
/>
<button
onClick={() => onRemoveImage(index)}
className="copilotKitImageUploadQueueRemoveButton"
style={{
position: "absolute",
top: "2px",
right: "2px",
background: "rgba(0,0,0,0.6)",
color: "white",
border: "none",
borderRadius: "50%",
width: "18px",
height: "18px",
display: "flex",
alignItems: "center",
justifyContent: "center",
cursor: "pointer",
fontSize: "10px",
padding: 0,
}}
>
✕
</button>
</div>
))}
</div>
);
};