File tree Expand file tree Collapse file tree 4 files changed +51
-7
lines changed
Sources/App/Views/PackageController Expand file tree Collapse file tree 4 files changed +51
-7
lines changed Original file line number Diff line number Diff line change 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.
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}
Original file line number Diff line number Diff line change 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 }
199209 }
200210 }
201211
202- .custom-collections {
212+ .custom-collections-sidebar {
203213 display : flex ;
204214 flex-direction : column ;
205215
Original file line number Diff line number Diff 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 ( ) ) ,
Original file line number Diff line number Diff 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) ,
You can’t perform that action at this time.
0 commit comments