Skip to content

Commit

Permalink
Merge pull request #542 from cofacts/fix/ux_image_article
Browse files Browse the repository at this point in the history
UX improvements of images in article page
  • Loading branch information
MrOrz committed Jul 11, 2023
2 parents d49aa7d + 30b8a6c commit 802dc59
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion components/ListPageDisplays/ArticleCard.js
Expand Up @@ -88,6 +88,7 @@ const useStyles = makeStyles(theme => ({
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
margin: '0 1em 0 0', // Add right margin that separate attachment and text with a space
},
}));

Expand Down Expand Up @@ -122,14 +123,14 @@ function ArticleCard({ article, highlight = '' }) {
<span>{c('Info box').t`reports`}</span>
</div>
</div>
<Thumbnail article={article} className={classes.attachment} />
{(text || highlight) && (
<ExpandableText className={classes.content} lineClamp={3}>
{highlight
? highlightSections(highlight, highlightClasses)
: text}
</ExpandableText>
)}
<Thumbnail article={article} className={classes.attachment} />
</div>
</ListPageCard>
</a>
Expand Down
Expand Up @@ -83,6 +83,19 @@ exports[`Storyshots ListPageDisplays/ListPageCards Article Cards 1`] = `
</span>
</div>
</div>
<Thumbnail
article={
Object {
"articleType": "TEXT",
"createdAt": "2020-01-01T00:00:00Z",
"id": "id1",
"replyCount": 3,
"replyRequestCount": 4,
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
}
}
className="makeStyles-attachment"
/>
<ExpandableText
className="makeStyles-content"
lineClamp={3}
Expand All @@ -102,19 +115,6 @@ exports[`Storyshots ListPageDisplays/ListPageCards Article Cards 1`] = `
</div>
</div>
</ExpandableText>
<Thumbnail
article={
Object {
"articleType": "TEXT",
"createdAt": "2020-01-01T00:00:00Z",
"id": "id1",
"replyCount": 3,
"replyRequestCount": 4,
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
}
}
className="makeStyles-attachment"
/>
</div>
</article>
</ListPageCard>
Expand Down Expand Up @@ -210,6 +210,19 @@ exports[`Storyshots ListPageDisplays/ListPageCards Article Cards 1`] = `
</span>
</div>
</div>
<Thumbnail
article={
Object {
"articleType": "TEXT",
"createdAt": "2019-01-01T00:00:00Z",
"id": "id2",
"replyCount": 0,
"replyRequestCount": 999,
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eu ex augue. Etiam posuere sagittis iaculis. Vestibulum sollicitudin nec felis a mollis. Phasellus ut est velit. Proin fermentum arcu ornare quam vulputate, vel eleifend velit ultrices. Fusce tincidunt vel urna at luctus.",
}
}
className="makeStyles-attachment"
/>
<ExpandableText
className="makeStyles-content"
lineClamp={3}
Expand Down Expand Up @@ -261,19 +274,6 @@ exports[`Storyshots ListPageDisplays/ListPageCards Article Cards 1`] = `
</div>
</div>
</ExpandableText>
<Thumbnail
article={
Object {
"articleType": "TEXT",
"createdAt": "2019-01-01T00:00:00Z",
"id": "id2",
"replyCount": 0,
"replyRequestCount": 999,
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eu ex augue. Etiam posuere sagittis iaculis. Vestibulum sollicitudin nec felis a mollis. Phasellus ut est velit. Proin fermentum arcu ornare quam vulputate, vel eleifend velit ultrices. Fusce tincidunt vel urna at luctus.",
}
}
className="makeStyles-attachment"
/>
</div>
</article>
</ListPageCard>
Expand Down

0 comments on commit 802dc59

Please sign in to comment.