From a123764087240f17b092b26003a99f3a51b5ed3b Mon Sep 17 00:00:00 2001 From: abhishek-01k Date: Tue, 15 Oct 2024 15:18:53 +0530 Subject: [PATCH] fix: fixed the twitter preview Size issue --- .../cards/message/PreviewRenderer.tsx | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/uiweb/src/lib/components/chat/ChatViewBubbleCore/cards/message/PreviewRenderer.tsx b/packages/uiweb/src/lib/components/chat/ChatViewBubbleCore/cards/message/PreviewRenderer.tsx index 3fa37a08d..3abcf6bdc 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewBubbleCore/cards/message/PreviewRenderer.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewBubbleCore/cards/message/PreviewRenderer.tsx @@ -3,6 +3,7 @@ import { useEffect, useState } from 'react'; // External Packages import { TwitterTweetEmbed } from 'react-twitter-embed'; +import styled from 'styled-components'; // Internal Compoonents import { IFrame } from '../../../../../types'; @@ -11,9 +12,8 @@ import { checkTwitterUrl } from '../../../helpers/twitter'; import { FrameRenderer } from './FrameRenderer'; import { VideoRenderer } from './VideoRenderer'; - // Internal Configs - +import { device } from '../../../../../config/globals'; // Assets // Interfaces & Types @@ -149,6 +149,31 @@ export const PreviewRenderer = ({ frameData={initialized.frameData} /> ) : !initialized.loading && !initialized.error && initialized.url && initialized.urlType === 'twitter' ? ( - + + + ) : null; }; + +const TwitterEmbedWrapper = styled.div` + width: 100%; + max-width: 550px; + margin: 0 auto; + overflow: hidden; + padding: 0 10px; + > div { + max-width: 100% !important; + } + + iframe { + max-width: 100% !important; + } + + @media (max-width: ${device.mobileL}) { + max-width: 100%; + + iframe { + width: 100% !important; + } + } +`;