Skip to content

Commit e86a550

Browse files
onebyte8bitswrdanielroe
authored
feat: package page right sidebar scroll (#805)
Co-authored-by: wr <wr@wrtekiMacBook-Pro.local> Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent 93bd291 commit e86a550

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

app/pages/package/[...package].vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,9 @@ defineOgImageComponent('Package', {
10881088

10891089
<div class="area-sidebar">
10901090
<!-- Sidebar -->
1091-
<div class="sticky top-34 space-y-6 sm:space-y-8 min-w-0 overflow-hidden xl:(top-22) pt-1">
1091+
<div
1092+
class="sidebar-scroll sticky top-34 space-y-6 sm:space-y-8 min-w-0 overflow-y-auto pr-2.5 hover:pr-0.5 lg:(max-h-[calc(100dvh-8.5rem)] overscroll-contain) xl:(top-22 pt-2 max-h-[calc(100dvh-6rem)])"
1093+
>
10921094
<!-- Maintainers (with admin actions when connected) -->
10931095
<PackageMaintainers :package-name="pkg.name" :maintainers="pkg.maintainers" />
10941096

@@ -1237,6 +1239,41 @@ defineOgImageComponent('Package', {
12371239
grid-area: sidebar;
12381240
}
12391241
1242+
/* Sidebar scrollbar: hidden by default, shown on hover/focus */
1243+
@media (min-width: 1024px) {
1244+
.sidebar-scroll {
1245+
scrollbar-gutter: stable;
1246+
scrollbar-width: none;
1247+
}
1248+
1249+
.sidebar-scroll::-webkit-scrollbar {
1250+
width: 0;
1251+
height: 0;
1252+
}
1253+
1254+
.sidebar-scroll:hover,
1255+
.sidebar-scroll:focus-within {
1256+
scrollbar-width: auto;
1257+
}
1258+
1259+
.sidebar-scroll:hover::-webkit-scrollbar,
1260+
.sidebar-scroll:focus-within::-webkit-scrollbar {
1261+
width: 8px;
1262+
height: 8px;
1263+
}
1264+
1265+
.sidebar-scroll:hover::-webkit-scrollbar-thumb,
1266+
.sidebar-scroll:focus-within::-webkit-scrollbar-thumb {
1267+
background-color: #cecece;
1268+
border-radius: 9999px;
1269+
}
1270+
1271+
.sidebar-scroll:hover::-webkit-scrollbar-track,
1272+
.sidebar-scroll:focus-within::-webkit-scrollbar-track {
1273+
background: transparent;
1274+
}
1275+
}
1276+
12401277
/* Improve package name wrapping for narrow screens */
12411278
.area-header h1 {
12421279
overflow-wrap: anywhere;

0 commit comments

Comments
 (0)