refactor(MessageAttachments): move styled component definition inside the component for better encapsulation

This commit is contained in:
kanweiwei 2025-04-24 15:56:48 +08:00 committed by 亢奋猫
parent e2396f3f14
commit 17eeab2897

View File

@ -19,6 +19,17 @@ interface Props {
message: Message
}
const StyledUpload = styled(Upload)`
.ant-upload-list-item-name {
max-width: 220px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: bottom;
}
`
const MessageAttachments: FC<Props> = ({ message }) => {
const handleCopyImage = async (image: FileType) => {
const data = await FileManager.readFile(image)
@ -66,17 +77,6 @@ const MessageAttachments: FC<Props> = ({ message }) => {
)
}
const StyledUpload = styled(Upload)`
.ant-upload-list-item-name {
max-width: 220px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: bottom;
}
`
return (
<Container style={{ marginTop: 2, marginBottom: 8 }} className="message-attachments">
<StyledUpload