From 7a8917b3396d8f17cc4ba84851ccdf053dfa2aa3 Mon Sep 17 00:00:00 2001 From: MrOrz Date: Fri, 7 Oct 2022 23:18:38 +0800 Subject: [PATCH 01/14] [ArticleCard] support audio and video --- components/ListPageDisplays/ArticleCard.js | 41 +- .../ListPageDisplays/ListPageCards.stories.js | 47 +++ .../ListPageCards.stories.storyshot | 359 +++++++++++++++++- 3 files changed, 437 insertions(+), 10 deletions(-) diff --git a/components/ListPageDisplays/ArticleCard.js b/components/ListPageDisplays/ArticleCard.js index 5648e0a9..4f9c6bfd 100644 --- a/components/ListPageDisplays/ArticleCard.js +++ b/components/ListPageDisplays/ArticleCard.js @@ -84,7 +84,7 @@ const useStyles = makeStyles(theme => ({ highlight: { color: theme.palette.primary[500], }, - attachmentImage: { + attachment: { minWidth: 0, // Don't use intrinsic image width as flex item min-size maxHeight: '10em', // Don't let image rows take too much vertical space }, @@ -100,6 +100,7 @@ function ArticleCard({ article, highlight = '' }) { const { id, text, + articleType, attachmentUrl, replyCount, replyRequestCount, @@ -135,13 +136,36 @@ function ArticleCard({ article, highlight = '' }) { : text} )} - {attachmentUrl && ( - image - )} + {(() => { + switch (articleType) { + case 'TEXT': + return null; + case 'IMAGE': + return ( + image + ); + case 'VIDEO': + return attachmentUrl ? ( +