Skip to content

Commit af288c3

Browse files
committed
feat: 为用户消息图片添加点击放大功能
1 parent a508709 commit af288c3

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

app/components/chat.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ import {
119119
showConfirm,
120120
showPrompt,
121121
showToast,
122+
showImageModal,
122123
} from "./ui-lib";
123124
import { useLocation, useNavigate } from "react-router-dom";
124125
import { FileIcon, defaultStyles } from "react-file-icon";
@@ -4957,7 +4958,14 @@ function ChatComponent() {
49574958
alt=""
49584959
width={80}
49594960
height={80}
4960-
style={{ maxWidth: "100%", height: "auto" }}
4961+
style={{
4962+
maxWidth: "100%",
4963+
height: "auto",
4964+
cursor: "pointer",
4965+
}}
4966+
onClick={() =>
4967+
showImageModal(getMessageImages(message)[0])
4968+
}
49614969
/>
49624970
)}
49634971
{getMessageImages(message).length > 1 && (
@@ -4980,7 +4988,12 @@ function ChatComponent() {
49804988
alt=""
49814989
width={80}
49824990
height={80}
4983-
style={{ maxWidth: "100%", height: "auto" }}
4991+
style={{
4992+
maxWidth: "100%",
4993+
height: "auto",
4994+
cursor: "pointer",
4995+
}}
4996+
onClick={() => showImageModal(image)}
49844997
/>
49854998
))}
49864999
</div>
@@ -5379,7 +5392,14 @@ function ChatComponent() {
53795392
alt=""
53805393
width={80}
53815394
height={80}
5382-
style={{ maxWidth: "100%", height: "auto" }}
5395+
style={{
5396+
maxWidth: "100%",
5397+
height: "auto",
5398+
cursor: "pointer",
5399+
}}
5400+
onClick={() =>
5401+
showImageModal(getMessageImages(message)[0])
5402+
}
53835403
/>
53845404
)}
53855405
{getMessageImages(message).length > 1 && (
@@ -5403,7 +5423,12 @@ function ChatComponent() {
54035423
alt=""
54045424
width={80}
54055425
height={80}
5406-
style={{ maxWidth: "100%", height: "auto" }}
5426+
style={{
5427+
maxWidth: "100%",
5428+
height: "auto",
5429+
cursor: "pointer",
5430+
}}
5431+
onClick={() => showImageModal(image)}
54075432
/>
54085433
);
54095434
})}

0 commit comments

Comments
 (0)