-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(blog): upgrade UI for archives and tags #542
Conversation
Reviewer's Guide by SourceryThis PR upgrades the UI for the blog's archives and tags pages, implementing a new alphabetical grouping system for tags and improving the overall layout and presentation of archived posts. The changes also include cleanup of tag metadata across blog posts and various component refinements. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @duyet - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟡 Documentation: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -16,25 +16,30 @@ If you are completely new to git, I suggest reading [Git Cheat Sheet](http://www | |||
|
|||
**Table of Contexts:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (documentation): Fix typo in heading: 'Contexts' should be 'Contents'
@@ -6,35 +6,60 @@ import Link from 'next/link' | |||
export default function Tags() { | |||
const tags: TagCount = getAllTags() | |||
|
|||
// Sort and keep tags with > 1 post | |||
const sortedTags = Object.fromEntries( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider simplifying the tag grouping logic by using a single sort operation with a composite comparator
The code can be simplified while maintaining the alphabetical grouping feature. Here's a more direct approach:
export default function Tags() {
const tags: TagCount = getAllTags()
// Sort by first letter then by count
const sortedEntries = Object.entries(tags)
.sort(([tagA, countA], [tagB, countB]) => {
const letterA = tagA[0].toUpperCase()
const letterB = tagB[0].toUpperCase()
return letterA === letterB ? countB - countA : letterA.localeCompare(letterB)
})
// Group visually by first letter
const currentLetter = { value: '' }
return (
<div>
<div className="lg:mb-15 mb-10">
<h1 className="mb-5 text-4xl font-bold md:text-6xl lg:text-8xl">
Topics
</h1>
<p className="lg:mb-15 mb-10">
This page lists my {sortedEntries.length} blogging topics in
alphabetical order.
</p>
</div>
<div className="flex flex-col gap-5">
{sortedEntries.map(([tag, count]) => {
const letter = tag[0].toUpperCase()
const letterHeader = letter !== currentLetter.value && (
<h1 className="mb-5 text-5xl font-bold">{letter}</h1>
)
currentLetter.value = letter
return (
<div key={tag}>
{letterHeader}
<Link
as={`/tag/${getSlug(tag)}`}
className="inline-flex gap-1"
href="/tag/[tag]"
>
<h3>{tag}</h3>
<span className="text-muted hover:no-underline">({count})</span>
</Link>
</div>
)
})}
</div>
</div>
)
}
Summary by Sourcery
Upgrade the blog UI by introducing alphabetical grouping of tags and enhancing the layout of the archives and tags pages. Refactor components to improve flexibility and readability, and update documentation for better clarity.
New Features:
Enhancements:
Documentation: