From 9352c030224059a865a7c0da1905e3940824ce86 Mon Sep 17 00:00:00 2001 From: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com> Date: Sun, 5 Jan 2025 16:17:56 +0530 Subject: [PATCH 1/2] Feat: Added 'Collapse & Uncollapse' Functionality for Audio, Video Messages & Image attachment (#772) * BUG: Fix extra top space for audio and video messages to improve UI consistency * Fix: Add padding for audio and video messages in nested attachments and quotes * added conditional CSS handling the description present or absent case * Same logic for conditional CSS but written in better way * Feat: Add 'Collapse & Uncollapse' functionality for Audio and Video messages * Feat: Add 'Collapse & Uncollapse' functionality * Feat: Add 'Collapse & Uncollapse' functionality * Added Collapse & Uncollapse Functionality for Image Attachment * Using chevron-down, chevron-left instead of arrow-down, arrow-right --- .../AttachmentHandler/AttachmentMetadata.js | 19 +++++++++- .../AttachmentHandler/AudioAttachment.js | 14 ++++++- .../AttachmentHandler/ImageAttachment.js | 30 ++++++++++----- .../AttachmentHandler/VideoAttachment.js | 38 ++++++++++++------- 4 files changed, 74 insertions(+), 27 deletions(-) diff --git a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js index 5bd249ce5..390cab7b7 100644 --- a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js +++ b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js @@ -3,7 +3,14 @@ import { css } from '@emotion/react'; import { ActionButton, Box } from '@embeddedchat/ui-elements'; import { Markdown } from '../Markdown'; -const AttachmentMetadata = ({ attachment, url, variantStyles = {}, msg }) => { +const AttachmentMetadata = ({ + attachment, + url, + variantStyles = {}, + msg, + onExpandCollapseClick, + isExpanded, +}) => { const handleDownload = async () => { try { const response = await fetch(url); @@ -78,6 +85,16 @@ const AttachmentMetadata = ({ attachment, url, variantStyles = {}, msg }) => { > {attachment.title}

+ { + setIsExpanded((prevState) => !prevState); + }; + return ( -