File size: 1,509 Bytes
4bae792
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { FiFileText, FiImage, FiFile } from "react-icons/fi";

function SharedFile({ isDark, fileName, time, type }) {
  // Get icon based on file type
  const getIcon = () => {
    if (type === "image") {
      return <FiImage size={12} />;
    }
    if (type === "pdf") {
      return <FiFile size={12} />;
    }
    return <FiFileText size={12} />;
  };

  // Get icon color based on type
  const getIconColor = () => {
    if (type === "pdf") {
      return "#ef4444";
    }
    if (type === "image") {
      return "#10b981";
    }
    return "var(--primary)";
  };

  return (
    <div
      className="flex items-center gap-2 p-2 rounded-md cursor-pointer"
      onMouseEnter={(e) =>
        (e.currentTarget.style.background = "var(--hover-primary)")
      }
      onMouseLeave={(e) => (e.currentTarget.style.background = "transparent")}
    >
      <div
        className="w-7 h-7 rounded-md flex items-center justify-center text-xs flex-shrink-0"
        style={{
          background: "var(--primary-active)",
          color: getIconColor(),
        }}
      >
        {getIcon()}
      </div>
      <div className="flex-1 min-w-0">
        <div
          className="text-xs truncate"
          style={{ color: "var(--text-primary)" }}
        >
          {fileName}
        </div>
        <div
          className="text-[11px] mt-0.5"
          style={{ color: "var(--text-muted)" }}
        >
          Gửi lúc {time}
        </div>
      </div>
    </div>
  );
}

export default SharedFile;