Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions packages/react/src/views/AttachmentHandler/AttachmentMetadata.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { css } from '@emotion/react';
import { ActionButton, Box, Tooltip } from '@embeddedchat/ui-elements';
import { Markdown } from '../Markdown';

const AttachmentMetadata = ({
attachment,
Expand Down Expand Up @@ -48,25 +47,21 @@ const AttachmentMetadata = ({
attachment.description !== ''
? [
css`
margin: 10px 0px;
margin-top: 0.5rem;
@media (max-width: 420px) {
margin: 5px 0px;
}
`,
]
: css`
margin: -7px 0px;
margin-top: -3px;
@media (max-width: 420px) {
margin: -5px 0px;
}
`
}
>
{msg ? (
<Markdown body={msg} md={attachment.descriptionMd} />
) : (
attachment.description
)}
{attachment.description}
</div>
<Box
css={css`
Expand All @@ -84,6 +79,7 @@ const AttachmentMetadata = ({
display: flex;
flex-direction: row;
align-items: center;
margin-top: ${attachment.description ? '0.5rem' : '0px'};
@media (max-width: 420px) {
flex-direction: column;
align-items: flex-start;
Expand Down Expand Up @@ -166,7 +162,7 @@ const AttachmentMetadata = ({
<Box
css={css`
margin-left: 10px;
margin-top: ${attachment.description ? '3px' : '10px'};
margin-top: 1px;
@media (max-width: 420px) {
margin-left: 0;
margin-top: 5px;
Expand All @@ -187,7 +183,7 @@ const AttachmentMetadata = ({
<Box
css={css`
margin-left: 10px;
margin-top: 5px;
margin-top: 3px;
@media (max-width: 420px) {
margin-left: 0;
margin-top: 5px;
Expand Down
59 changes: 29 additions & 30 deletions packages/react/src/views/AttachmentHandler/AudioAttachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const AudioAttachment = ({
css`
line-height: 0;
border-radius: inherit;
padding: 0.5rem;
`,
(type ? variantStyles.pinnedContainer : '') ||
css`
Expand All @@ -52,6 +51,7 @@ const AudioAttachment = ({
display: flex;
gap: 0.3rem;
align-items: center;
padding: 0.5rem;
`,
variantStyles.textUserInfo,
]}
Expand All @@ -67,28 +67,16 @@ const AudioAttachment = ({
) : (
''
)}
<Box
css={css`
@media (max-width: 450px) {
margin-top: 0.4rem;
}
`}
>
<AttachmentMetadata
attachment={attachment}
url={host + (attachment.title_url || attachment.audio_url)}
variantStyles={variantStyles}
msg={msg}
onExpandCollapseClick={toggleExpanded}
isExpanded={isExpanded}
/>
</Box>
<AttachmentMetadata
attachment={attachment}
url={host + (attachment.title_url || attachment.audio_url)}
variantStyles={variantStyles}
msg={msg}
onExpandCollapseClick={toggleExpanded}
isExpanded={isExpanded}
/>
{isExpanded && (
<audio
src={host + attachment.audio_url}
style={{ maxHeight: '100%', maxWidth: '100%' }}
controls
/>
<audio src={host + attachment.audio_url} width="100%" controls />
)}

{attachment.attachments &&
Expand Down Expand Up @@ -119,6 +107,7 @@ const AudioAttachment = ({
display: flex;
gap: 0.3rem;
align-items: center;
padding: 0.5rem;
`,
variantStyles.textUserInfo,
]}
Expand All @@ -134,18 +123,28 @@ const AudioAttachment = ({
) : (
''
)}
<AttachmentMetadata
attachment={nestedAttachment}
url={
host +
(nestedAttachment.title_url || nestedAttachment.audio_url)
}
variantStyles={variantStyles}
/>
<Box
css={css`
padding-left: 0.5rem;
`}
>
<AttachmentMetadata
attachment={nestedAttachment}
url={
host +
(nestedAttachment.title_url || nestedAttachment.audio_url)
}
variantStyles={variantStyles}
/>
</Box>
<audio
src={host + nestedAttachment.audio_url}
width="100%"
controls
style={{
paddingLeft: '0.5rem',
paddingBottom: '0.5rem',
}}
/>
</Box>
</Box>
Expand Down
22 changes: 14 additions & 8 deletions packages/react/src/views/AttachmentHandler/VideoAttachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,20 @@ const VideoAttachment = ({
) : (
''
)}
<AttachmentMetadata
attachment={nestedAttachment}
url={
host +
(nestedAttachment.title_url || nestedAttachment.video_url)
}
variantStyles={variantStyles}
/>
<Box
css={css`
padding-left: 0.5rem;
`}
>
<AttachmentMetadata
attachment={nestedAttachment}
url={
host +
(nestedAttachment.title_url || nestedAttachment.video_url)
}
variantStyles={variantStyles}
/>
</Box>
<video
width="100%"
controls
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-elements/src/theme/DefaultTheme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DefaultTheme = {
radius: '0.2rem',
radius: '1.5rem',

commonColors: {
black: 'hsl(0, 100%, 0%)',
Expand Down
Loading