diff --git a/__tests__/components/drops/view/part/DropPartMarkdown.test.tsx b/__tests__/components/drops/view/part/DropPartMarkdown.test.tsx index 5bf532e1b7..f84952a025 100644 --- a/__tests__/components/drops/view/part/DropPartMarkdown.test.tsx +++ b/__tests__/components/drops/view/part/DropPartMarkdown.test.tsx @@ -393,9 +393,11 @@ describe("DropPartMarkdown", () => { ); const stableFrame = screen.getByTestId("youtube-preview-stable-frame"); + const mediaFrame = screen.getByTestId("youtube-preview-media-frame"); expect(stableFrame).toBeInTheDocument(); - expect(stableFrame.className).toContain("tw-h-[13rem]"); - expect(stableFrame.className).toContain("md:tw-h-[15rem]"); + expect(stableFrame.className).not.toContain("tw-h-[13rem]"); + expect(stableFrame.className).not.toContain("md:tw-h-[15rem]"); + expect(mediaFrame.className).toContain("tw-aspect-video"); resolvePreview?.(preview); @@ -501,8 +503,10 @@ describe("DropPartMarkdown", () => { ); const stableFrame = screen.getByTestId("youtube-preview-stable-frame"); - expect(stableFrame.className).toContain("tw-h-[13rem]"); - expect(stableFrame.className).toContain("md:tw-h-[15rem]"); + const mediaFrame = screen.getByTestId("youtube-preview-media-frame"); + expect(stableFrame.className).not.toContain("tw-h-[13rem]"); + expect(stableFrame.className).not.toContain("md:tw-h-[15rem]"); + expect(mediaFrame.className).toContain("tw-aspect-video"); const fallbackLink = await screen.findByTestId( "youtube-preview-fallback-link" @@ -526,8 +530,10 @@ describe("DropPartMarkdown", () => { ); const stableFrame = screen.getByTestId("youtube-preview-stable-frame"); - expect(stableFrame.className).toContain("tw-h-[13rem]"); - expect(stableFrame.className).toContain("md:tw-h-[15rem]"); + const mediaFrame = screen.getByTestId("youtube-preview-media-frame"); + expect(stableFrame.className).not.toContain("tw-h-[13rem]"); + expect(stableFrame.className).not.toContain("md:tw-h-[15rem]"); + expect(mediaFrame.className).toContain("tw-aspect-video"); const fallbackLink = await screen.findByTestId( "youtube-preview-fallback-link" @@ -551,8 +557,10 @@ describe("DropPartMarkdown", () => { ); const stableFrame = screen.getByTestId("youtube-preview-stable-frame"); - expect(stableFrame.className).toContain("tw-h-[13rem]"); - expect(stableFrame.className).toContain("md:tw-h-[15rem]"); + const mediaFrame = screen.getByTestId("youtube-preview-media-frame"); + expect(stableFrame.className).not.toContain("tw-h-[13rem]"); + expect(stableFrame.className).not.toContain("md:tw-h-[15rem]"); + expect(mediaFrame.className).toContain("tw-aspect-video"); const fallbackLink = await screen.findByTestId( "youtube-preview-fallback-link" diff --git a/components/drops/view/part/dropPartMarkdown/youtubePreview.tsx b/components/drops/view/part/dropPartMarkdown/youtubePreview.tsx index 8eecef7b97..ef8d9d7195 100644 --- a/components/drops/view/part/dropPartMarkdown/youtubePreview.tsx +++ b/components/drops/view/part/dropPartMarkdown/youtubePreview.tsx @@ -230,11 +230,13 @@ type PreviewState = { readonly showEmbed: boolean; }; -const YOUTUBE_STABLE_FRAME_CLASSES = - "tw-h-[13rem] tw-min-h-[13rem] tw-max-h-[13rem] tw-w-full md:tw-h-[15rem] md:tw-min-h-[15rem] md:tw-max-h-[15rem]"; +const YOUTUBE_STABLE_FRAME_CLASSES = "tw-min-w-0 tw-flex-1"; const YOUTUBE_CARD_CLASSES = - "tw-flex tw-h-full tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-lg"; + "tw-flex tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-lg"; + +const YOUTUBE_MEDIA_FRAME_CLASSES = + "tw-relative tw-aspect-video tw-w-full tw-overflow-hidden tw-bg-black"; const YOUTUBE_META_CLASSES = "tw-flex tw-h-11 tw-shrink-0 tw-flex-col tw-justify-center tw-gap-y-0.5 tw-overflow-hidden tw-border-0 tw-border-t tw-border-solid tw-border-iron-800 tw-bg-iron-900/95 tw-px-3"; @@ -363,7 +365,10 @@ const YoutubePreview = ({ href }: YoutubePreviewProps) => { if (isLoading) { return (
-
+
@@ -379,7 +384,10 @@ const YoutubePreview = ({ href }: YoutubePreviewProps) => { return (
-
+
{showEmbed ? (
{ data-testid="youtube-preview-fallback-link" className={`${YOUTUBE_CARD_CLASSES} tw-border tw-border-solid tw-border-iron-700 tw-bg-iron-900/40 tw-no-underline tw-transition-colors tw-duration-200 hover:tw-border-iron-500 focus-visible:tw-outline focus-visible:tw-outline-2 focus-visible:tw-outline-offset-2 focus-visible:tw-outline-primary-400`} > -
+
{fallbackMessage} @@ -463,7 +474,7 @@ const YoutubePreview = ({ href }: YoutubePreviewProps) => { return (
{card()} diff --git a/components/user/utils/icons/SocialStatementIcon.tsx b/components/user/utils/icons/SocialStatementIcon.tsx index 36ed92e9b8..0a8af45e54 100644 --- a/components/user/utils/icons/SocialStatementIcon.tsx +++ b/components/user/utils/icons/SocialStatementIcon.tsx @@ -105,5 +105,6 @@ export default function SocialStatementIcon({ return ; default: assertUnreachable(statementType); + return null; } }