0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added formatting for numbers in Tab counters and FeedItem stat counters

ref https://linear.app/tryghost/issue/AP-425/use-formatted-numbers-everywhere
This commit is contained in:
Djordje Vlaisavljevic 2024-09-23 20:31:18 +01:00
parent b7ef6ef521
commit 281f497606
2 changed files with 7 additions and 3 deletions

View file

@ -185,7 +185,7 @@ const FeedItemStats: React.FC<{
handleLikeClick();
}}
/>
{isLiked && <span className={`text-grey-900`}>{likeCount}</span>}
{isLiked && <span className={`text-grey-900`}>{new Intl.NumberFormat().format(likeCount)}</span>}
</div>
<div className='flex gap-1'>
<Button
@ -201,7 +201,7 @@ const FeedItemStats: React.FC<{
}}
/>
{commentCount > 0 && (
<span className={`text-grey-900`}>{commentCount}</span>
<span className={`text-grey-900`}>{new Intl.NumberFormat().format(commentCount)}</span>
)}
</div>
</div>);

View file

@ -50,7 +50,11 @@ export const TabButton: React.FC<TabButtonProps> = ({
>
{icon && <Icon className='mb-0.5 mr-1.5 inline' name={icon} size='sm' />}
{title}
{(typeof counter === 'number') && <span className='ml-1.5 rounded-full bg-grey-200 px-1.5 py-[2px] text-xs font-medium text-grey-800 dark:bg-grey-900 dark:text-grey-300'>{counter}</span>}
{(typeof counter === 'number') &&
<span className='ml-1.5 rounded-full bg-grey-200 px-1.5 py-[2px] text-xs font-medium text-grey-800 dark:bg-grey-900 dark:text-grey-300'>
{new Intl.NumberFormat().format(counter)}
</span>
}
</TabsPrimitive.Trigger>
);
};