Skip to content

Commit 943b08d

Browse files
wrwr
authored andcommitted
feat: package page right sidebar scroll
1 parent 50f9c68 commit 943b08d

1 file changed

Lines changed: 53 additions & 1 deletion

File tree

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

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ defineOgImageComponent('Package', {
10101010

10111011
<div class="area-sidebar">
10121012
<!-- Sidebar -->
1013-
<div class="sticky top-34 space-y-6 sm:space-y-8 min-w-0 overflow-hidden xl:(top-22 pt-2)">
1013+
<div class="sidebar-scroll sticky top-34 space-y-6 sm:space-y-8 min-w-0 xl:(top-22 pt-2)">
10141014
<!-- Maintainers (with admin actions when connected) -->
10151015
<PackageMaintainers :package-name="pkg.name" :maintainers="pkg.maintainers" />
10161016

@@ -1159,6 +1159,58 @@ defineOgImageComponent('Package', {
11591159
grid-area: sidebar;
11601160
}
11611161
1162+
/* Keep sidebar scrollable inside viewport when hovered/focused. */
1163+
.sidebar-scroll {
1164+
overflow-y: auto;
1165+
padding-right: 10px;
1166+
}
1167+
1168+
.sidebar-scroll:hover {
1169+
padding-right: 2px;
1170+
}
1171+
1172+
@media (min-width: 1024px) {
1173+
.sidebar-scroll {
1174+
max-height: calc(100dvh - 8.5rem);
1175+
overscroll-behavior: contain;
1176+
scrollbar-gutter: stable;
1177+
scrollbar-width: none;
1178+
}
1179+
1180+
.sidebar-scroll::-webkit-scrollbar {
1181+
width: 0;
1182+
height: 0;
1183+
}
1184+
1185+
.sidebar-scroll:hover,
1186+
.sidebar-scroll:focus-within {
1187+
scrollbar-width: auto;
1188+
}
1189+
1190+
.sidebar-scroll:hover::-webkit-scrollbar,
1191+
.sidebar-scroll:focus-within::-webkit-scrollbar {
1192+
width: 8px;
1193+
height: 8px;
1194+
}
1195+
1196+
.sidebar-scroll:hover::-webkit-scrollbar-thumb,
1197+
.sidebar-scroll:focus-within::-webkit-scrollbar-thumb {
1198+
background-color: #cecece;
1199+
border-radius: 9999px;
1200+
}
1201+
1202+
.sidebar-scroll:hover::-webkit-scrollbar-track,
1203+
.sidebar-scroll:focus-within::-webkit-scrollbar-track {
1204+
background: transparent;
1205+
}
1206+
}
1207+
1208+
@media (min-width: 1280px) {
1209+
.sidebar-scroll {
1210+
max-height: calc(100dvh - 6rem);
1211+
}
1212+
}
1213+
11621214
/* Improve package name wrapping for narrow screens */
11631215
.area-header h1 {
11641216
overflow-wrap: anywhere;

0 commit comments

Comments
 (0)