Skip to content

Commit

Permalink
fix: handle undefined likes in poster-horizontal
Browse files Browse the repository at this point in the history
- Replace Typography with TextMaxLine for likes display, ensuring it handles undefined likes gracefully by defaulting to 0.
- Adjust line clamping behavior for improved visual consistency.
  • Loading branch information
cswni committed Dec 4, 2024
1 parent acc4dd0 commit daa3938
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/poster/variants/poster-horizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ const PosterHorizontal = ({ title, images, likes, id, synopsis }: Poster) => {
<Box sx={{display:'flex',alignItems:'center',justifyContent: 'space-between'}}>
<Stack direction="row" spacing={0.5} alignItems='center' textAlign='center'>
<IconHeartFilled style={{marginBottom:'2px'}} size={16} color="#F2F3F5" />
<Typography style={{fontSize: 'clamp(0.1rem, 0.8vw, 0.9rem)', fontWeight: '700', whiteSpace: 'nowrap'}} variant="body2">
{formatLikes(likes)}
</Typography>
<TextMaxLine line={1} variant="body2">
{formatLikes(likes ?? 0)}
</TextMaxLine>
</Stack>
</Box>
</Box>
Expand Down

0 comments on commit daa3938

Please sign in to comment.