diff --git a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js index 390cab7b71..17e25c03db 100644 --- a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js +++ b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js @@ -1,6 +1,6 @@ import React from 'react'; import { css } from '@emotion/react'; -import { ActionButton, Box } from '@embeddedchat/ui-elements'; +import { ActionButton, Box, Tooltip } from '@embeddedchat/ui-elements'; import { Markdown } from '../Markdown'; const AttachmentMetadata = ({ @@ -16,7 +16,6 @@ const AttachmentMetadata = ({ const response = await fetch(url); const data = await response.blob(); const downloadUrl = URL.createObjectURL(data); - const anchor = document.createElement('a'); anchor.href = downloadUrl; anchor.download = attachment.title || 'download'; @@ -36,6 +35,10 @@ const AttachmentMetadata = ({ css` display: flex; flex-direction: column; + @media (max-width: 420px) { + flex-direction: column; + align-items: flex-start; + } `, variantStyles.attachmentMetaContainer, ]} @@ -46,10 +49,16 @@ const AttachmentMetadata = ({ ? [ css` margin: 10px 0px; + @media (max-width: 420px) { + margin: 5px 0px; + } `, ] : css` margin: -7px 0px; + @media (max-width: 420px) { + margin: -5px 0px; + } ` } > @@ -64,47 +73,137 @@ const AttachmentMetadata = ({ display: flex; flex-direction: row; align-items: center; + @media (max-width: 420px) { + flex-direction: column; + align-items: flex-start; + } `} > -
- {attachment.title} -
-+ {attachment.title.length > 22 + ? `${attachment.title.substring(0, 22)}...` + : attachment.title} +
+