From bd8e7cf4fff11641290a61222dd469d1f3f25dcd Mon Sep 17 00:00:00 2001 From: danidfra Date: Sun, 3 Nov 2024 19:58:47 -0300 Subject: [PATCH] Change preview-card to use only Tailwind --- src/components/preview-card.tsx | 26 ++++++++++++++------------ src/utils/media.ts | 5 +++++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/components/preview-card.tsx b/src/components/preview-card.tsx index fe51863c1..71d56bfb0 100644 --- a/src/components/preview-card.tsx +++ b/src/components/preview-card.tsx @@ -3,11 +3,13 @@ import { List as ImmutableList } from 'immutable'; import React, { useState, useEffect } from 'react'; import Blurhash from 'soapbox/components/blurhash'; -import { HStack, Stack, Text, Icon } from 'soapbox/components/ui'; +import { HStack, Stack, Text } from 'soapbox/components/ui'; import { normalizeAttachment } from 'soapbox/normalizers'; import { addAutoPlay } from 'soapbox/utils/media'; import { getTextDirection } from 'soapbox/utils/rtl'; +import SvgIcon from './ui/icon/svg-icon'; + import type { Card as CardEntity, Attachment } from 'soapbox/types/entities'; /** Props for `PreviewCard`. */ @@ -89,7 +91,7 @@ const PreviewCard: React.FC = ({ return (
@@ -106,7 +108,7 @@ const PreviewCard: React.FC = ({ const interactive = card.type !== 'link'; horizontal = typeof horizontal === 'boolean' ? horizontal : interactive || embedded; - const className = clsx('status-card', { horizontal, compact, interactive }, `status-card--${card.type}`); + const className = clsx('flex overflow-hidden rounded-lg border border-solid border-gray-200 text-sm text-gray-800 no-underline dark:border-gray-800 dark:text-gray-200', { horizontal, compact, interactive }, `status-card--${card.type}`); const ratio = getRatio(card); const height = (compact && !embedded) ? (width / (16 / 9)) : (width / ratio); @@ -135,7 +137,7 @@ const PreviewCard: React.FC = ({ )} - + {card.provider_name} @@ -160,7 +162,7 @@ const PreviewCard: React.FC = ({ width: horizontal ? width : undefined, height: horizontal ? height : undefined, }} - className='status-card__image-image' + className='block size-full bg-cover bg-center object-cover' /> ); @@ -175,7 +177,7 @@ const PreviewCard: React.FC = ({ } embed = ( -
+
{canvas} {thumbnail} @@ -183,9 +185,9 @@ const PreviewCard: React.FC = ({
@@ -197,9 +199,9 @@ const PreviewCard: React.FC = ({ rel='noopener' className='text-gray-700 hover:text-gray-900 dark:text-gray-500 dark:hover:text-gray-100' > - )} @@ -219,7 +221,7 @@ const PreviewCard: React.FC = ({ } else if (card.image) { embed = (