Skip to content

Commit

Permalink
feat: add localeString to view count
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorusclarence committed May 11, 2022
1 parent 3f87ffb commit dde26fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/content/blog/BlogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function BlogCard({
</div>
<div className='flex items-center gap-1'>
<HiOutlineEye className='inline-block text-base' />
<Accent>{post?.views ?? '–––'} views</Accent>
<Accent>{post?.views?.toLocaleString() ?? '–––'} views</Accent>
</div>
</div>
<p className='mt-4 mb-2 text-sm text-gray-600 dark:text-gray-300'>
Expand Down
10 changes: 7 additions & 3 deletions src/pages/blog/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default function SingleBlogPage({
<Tooltip
content={
<>
{meta.devtoViews} views on{' '}
{meta.devtoViews.toLocaleString()} views on{' '}
<CustomLink href='https://dev.to/theodorusclarence'>
dev.to
</CustomLink>
Expand All @@ -159,13 +159,17 @@ export default function SingleBlogPage({
>
<div className='flex items-center gap-1'>
<HiOutlineEye className='inline-block text-base' />
<Accent>{meta?.views ?? '–––'} views</Accent>
<Accent>
{meta?.views?.toLocaleString() ?? '–––'} views
</Accent>
</div>
</Tooltip>
) : (
<div className='flex items-center gap-1'>
<HiOutlineEye className='inline-block text-base' />
<Accent>{meta?.views ?? '–––'} views</Accent>
<Accent>
{meta?.views?.toLocaleString() ?? '–––'} views
</Accent>
</div>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/library/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export default function SingleLibraryPage({ code, frontmatter }: LibraryType) {
<div className='mt-2 flex items-center justify-start gap-3 text-sm font-medium text-gray-600 dark:text-gray-300'>
<div className='flex items-center gap-1'>
<HiOutlineEye className='inline-block text-base' />
<Accent>{meta?.views ?? '–––'} views</Accent>
<Accent>
{meta?.views?.toLocaleString() ?? '–––'} views
</Accent>
</div>
<span></span>
<TechIcons
Expand Down
2 changes: 1 addition & 1 deletion src/pages/projects/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function SingleProjectPage({ code, frontmatter }: ProjectType) {
<div className='mt-2 flex flex-wrap items-center justify-start gap-3 text-sm font-medium text-gray-600 dark:text-gray-300'>
<div className='flex items-center gap-1'>
<HiOutlineEye className='inline-block text-base' />
{meta?.views ?? '–––'} views
{meta?.views?.toLocaleString() ?? '–––'} views
</div>
{(frontmatter.github ||
frontmatter.youtube ||
Expand Down

1 comment on commit dde26fa

@vercel
Copy link

@vercel vercel bot commented on dde26fa May 11, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.