feat: Adds more navigation items to sidebar and removes top navigation bar.
All checks were successful
CI / release (push) Successful in 6m53s
All checks were successful
CI / release (push) Successful in 6m53s
This commit is contained in:
@@ -41,16 +41,19 @@ struct ArticleGrid: NodeConvertible {
|
||||
allItems.years().sorted { $0 > $1 }
|
||||
}
|
||||
|
||||
private var sortedTags: [String] {
|
||||
allItems.uniqueTags().sorted { $0 < $1 }
|
||||
private var sortedTags: [(String, Int)] {
|
||||
allItems.uniqueTagsWithCount()
|
||||
}
|
||||
|
||||
private func sidebarLink(
|
||||
_ label: String,
|
||||
href: String
|
||||
) -> Node {
|
||||
a(class: "text-slate-300 font-semibold [&:hover]:text-slate-200", href: href) {
|
||||
div(class: "flex w-full p-2 [&:hover]:border-b border-orange-400") {
|
||||
a(
|
||||
class: "text-slate-300 font-semibold [&:hover]:text-slate-200",
|
||||
href: href
|
||||
) {
|
||||
div(class: "flex w-full p-2 [&:hover]:border-b border-orange-400\(href == canocicalURL ? " active" : "")") {
|
||||
span(class: "mx-8") { label }
|
||||
}
|
||||
}
|
||||
@@ -64,16 +67,19 @@ struct ArticleGrid: NodeConvertible {
|
||||
rssLink: rssLink,
|
||||
extraHeader: extraHeader
|
||||
) {
|
||||
div(class: "grid grid-cols-4 -mt-2") {
|
||||
div(class: "grid grid-cols-4") {
|
||||
// Sidebar
|
||||
div(class: "overflow-auto border-r border-slate-200") {
|
||||
section(class: "pt-2") {
|
||||
sidebarLink("All Articles", href: "/articles/")
|
||||
}
|
||||
// Years
|
||||
section(class: "pt-2") {
|
||||
div(class: "flex ps-2") {
|
||||
span(class: "mt-2 ps-2 font-extrabold text-slate-400") { "YEARS" }
|
||||
}
|
||||
sortedYears.map { year in
|
||||
sidebarLink(year, href: "/articles/\(year)")
|
||||
sidebarLink(year, href: "/articles/\(year)/")
|
||||
}
|
||||
}
|
||||
// Tags
|
||||
@@ -81,8 +87,8 @@ struct ArticleGrid: NodeConvertible {
|
||||
div(class: "flex ps-2 pt-2") {
|
||||
span(class: "mt-2 ps-2 font-extrabold text-slate-400") { "TAGS" }
|
||||
}
|
||||
sortedTags.map { tag in
|
||||
sidebarLink(tag, href: "/articles/tag/\(tag)")
|
||||
sortedTags.map { tag, count in
|
||||
sidebarLink("\(tag) (\(count))", href: "/articles/tag/\(tag)/")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user