1
Fork 0

Add total items bubble

This commit is contained in:
viktorstrate 2021-02-12 16:22:35 +01:00
parent ce3090394b
commit 265025bdf8
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
1 changed files with 30 additions and 2 deletions

View File

@ -13,6 +13,7 @@ const MediaWrapper = styled.div`
height: 210px;
position: relative;
margin: -4px;
padding-right: 16px;
overflow: hidden;
@ -36,8 +37,22 @@ const GroupAlbumWrapper = styled.div`
margin: 12px 8px 0;
`
const TotalItemsBubble = styled(Link)`
position: absolute;
top: 24px;
right: 6px;
background-color: white;
border-radius: 50%;
padding: 8px 0;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
color: black;
width: 36px;
height: 36px;
text-align: center;
`
const TimelineGroupAlbum = ({
group: { album, media /* mediaTotal */ },
group: { album, media, mediaTotal },
onSelectMedia,
setPresenting,
activeIndex,
@ -60,12 +75,25 @@ const TimelineGroupAlbum = ({
/>
))
let itemsBubble = null
const mediaVisibleCount = media.length
if (mediaTotal > mediaVisibleCount) {
itemsBubble = (
<TotalItemsBubble to={`/album/${album.id}`}>
{`+${Math.min(mediaTotal - mediaVisibleCount, 99)}`}
</TotalItemsBubble>
)
}
return (
<GroupAlbumWrapper>
<AlbumTitle>
<Link to={`/album/${album.id}`}>{album.title}</Link>
</AlbumTitle>
<MediaWrapper>{mediaElms}</MediaWrapper>
<MediaWrapper>
{mediaElms}
{itemsBubble}
</MediaWrapper>
</GroupAlbumWrapper>
)
}