Skip to content

Commit

Permalink
Tweak card logic
Browse files Browse the repository at this point in the history
  • Loading branch information
katamartin committed Sep 5, 2023
1 parent 090453a commit b3062b3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pages/cards/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ const Card = ({ title, authors, date, number }) => {
setLines(Math.round(titleText.current?.offsetHeight / 67))
}, [])

const shouldInline = (i) => {
if (lines < 4) {
return false
}

if (authors.length > 3) {
return true
}

if (i > 0) {
return true
}
}

return (
<Flex
sx={{
Expand Down Expand Up @@ -66,7 +80,7 @@ const Card = ({ title, authors, date, number }) => {
<Box
key={a}
sx={{
display: lines >= 4 && i > 0 ? 'inline-block' : 'block',
display: shouldInline(i) ? 'inline-block' : 'block',
color: AUTHOR_COLORS[(number + i) % 4],
}}
>
Expand Down

1 comment on commit b3062b3

@vercel
Copy link

@vercel vercel bot commented on b3062b3 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blog – ./

blog-git-main-carbonplan.vercel.app
blog.carbonplan.org
blog-carbonplan.vercel.app

Please sign in to comment.