Skip to content

Commit 9359d35

Browse files
committed
Added another variant back to the metadata lists.
1 parent c863556 commit 9359d35

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

FrontEnd/styles/colors.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
--debug-console-background: var(--light-blue);
192192
--debug-console-border: var(--grey);
193193
--debug-console-button-hover: var(--light-grey);
194+
195+
--custom-collections-badge-background: var(--dark-grey);
196+
--custom-collections-badge-text: var(--white);
194197
}
195198

196199
// Dark mode.
@@ -317,5 +320,8 @@
317320
--debug-console-background: var(--dark-blue);
318321
--debug-console-border: var(--light-grey);
319322
--debug-console-button-hover: var(--dark-grey);
323+
324+
--custom-collections-badge-background: var(--light-grey);
325+
--custom-collections-badge-text: var(--black);
320326
}
321327
}

FrontEnd/styles/package.scss

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,22 @@
159159

160160
li.custom-collections {
161161
grid-column-start: span 2;
162-
background-image: var(--image-tags);
162+
background-image: var(--image-custom-collections);
163163

164164
a {
165-
display: flex;
166-
gap: 5px;
167-
align-items: center;
165+
vertical-align: baseline;
166+
167+
.badge {
168+
position: relative;
169+
top: -1px;
170+
margin-right: 3px;
171+
padding: 1px 5px;
172+
font-size: 12px;
173+
font-weight: 600;
174+
color: var(--custom-collections-badge-text);
175+
background-color: var(--custom-collections-badge-background);
176+
border-radius: 3px;
177+
}
168178
}
169179
}
170180
}
@@ -199,7 +209,7 @@
199209
}
200210
}
201211

202-
.custom-collections {
212+
.custom-collections-sidebar {
203213
display: flex;
204214
flex-direction: column;
205215

Sources/App/Views/PackageController/GetRoute.Model+ext.swift

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,38 @@ extension API.PackageController.GetRoute.Model {
398398
}
399399
}
400400

401+
func customCollectionsListItem() -> Node<HTML.ListContext> {
402+
guard customCollections.isEmpty == false
403+
else { return .empty }
404+
405+
let closing = if customCollections.count > 1 { " collections." } else { " collection." }
406+
407+
return .li(
408+
.class("custom-collections"),
409+
.group(listPhrase(opening: .text("Member of the "),
410+
nodes: customCollections.map({ collection in
411+
.a(
412+
.href(SiteURL.collections(.value(collection.key)).relativeURL()),
413+
.unwrap(collection.badge, { badge in
414+
.span(
415+
.class("badge"),
416+
.text(badge)
417+
)
418+
}),
419+
.text(collection.name)
420+
)
421+
}),
422+
closing: .text(closing))
423+
)
424+
)
425+
}
426+
401427
func customCollectionBadges() -> Node<HTML.BodyContext> {
402-
guard customCollections.isEmpty == false else { return .empty }
428+
guard customCollections.isEmpty == false
429+
else { return .empty }
403430

404431
return .div(
405-
.class("custom-collections"),
432+
.class("custom-collections-sidebar"),
406433
.forEach(customCollections, { collection in
407434
.a(
408435
.href(SiteURL.collections(.value(collection.key)).relativeURL()),

Sources/App/Views/PackageController/PackageShow+View.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ extension PackageShow {
174174
model.historyListItem(),
175175
model.activityListItem(),
176176
model.dependenciesListItem(),
177+
model.customCollectionsListItem(),
177178
model.licenseListItem(),
178179
model.starsListItem(),
179180
model.productTypeListItem(.library),

0 commit comments

Comments
 (0)