Files
blitzkit/packages/website/src/components/Scroller/index.module.css
T

170 lines
2.9 KiB
CSS
Raw Normal View History

2026-10-13 20:40:47 -05:00
.scroller {
2026-10-13 20:53:15 -05:00
--scroller-curtain-color: var(--gray-1);
--scroller-curtain-size: min(25%, var(--space-6));
2026-10-13 20:53:15 -05:00
2026-10-13 20:40:47 -05:00
display: flex;
flex-direction: column;
gap: var(--space-3);
position: relative;
.content {
overflow: auto;
/* Contains children's stacking so the bars always sit above them */
isolation: isolate;
2026-10-13 20:40:47 -05:00
/* The custom bars overlay the content instead of taking a gutter */
scrollbar-width: none;
2026-10-13 20:40:47 -05:00
&::-webkit-scrollbar {
display: none;
2026-10-13 20:40:47 -05:00
}
}
&:hover,
&:focus-within,
&:has([data-dragging="true"]) {
.bar {
2026-10-13 20:40:47 -05:00
opacity: 1;
}
}
&[data-orientation="vertical"],
&[data-orientation="both"] {
min-height: 0;
2026-10-13 20:40:47 -05:00
.content {
flex: 1 1 auto;
min-height: 0;
padding-bottom: 0;
}
}
&[data-orientation="vertical"] {
.content {
overflow-x: hidden;
overflow-y: auto;
}
}
.curtain {
position: absolute;
opacity: 0;
pointer-events: none;
&[data-axis="x"] {
2026-10-13 20:53:15 -05:00
top: 0;
2026-10-13 20:40:47 -05:00
width: var(--scroller-curtain-size);
height: 100%;
2026-10-13 20:53:15 -05:00
&[data-side="start"] {
left: 0;
background: linear-gradient(
90deg,
var(--scroller-curtain-color),
transparent
);
}
2026-10-13 20:40:47 -05:00
2026-10-13 20:53:15 -05:00
&[data-side="end"] {
right: 0;
background: linear-gradient(
90deg,
transparent,
var(--scroller-curtain-color)
);
}
2026-10-13 20:40:47 -05:00
}
2026-10-13 20:53:15 -05:00
&[data-axis="y"] {
2026-10-13 20:53:15 -05:00
left: 0;
width: 100%;
height: var(--scroller-curtain-size);
2026-10-13 20:53:15 -05:00
&[data-side="start"] {
top: 0;
background: linear-gradient(
180deg,
var(--scroller-curtain-color),
transparent
);
}
&[data-side="end"] {
bottom: 0;
background: linear-gradient(
180deg,
transparent,
var(--scroller-curtain-color)
);
}
}
}
.bar {
2026-11-17 23:48:31 -06:00
/* TODO: temporarily hidden */
display: none !important;
position: absolute;
2026-10-13 20:53:15 -05:00
opacity: 0;
transition: opacity var(--duration-brief);
&[data-hidden="true"] {
display: none;
}
&[data-axis="x"] {
left: 0;
right: 0;
bottom: 0;
height: var(--space-4);
}
&[data-axis="y"] {
top: 0;
bottom: 0;
right: 0;
width: var(--space-4);
}
.thumb {
position: absolute;
2026-11-19 16:59:43 -06:00
border-radius: var(--radius-max);
background-color: var(--gray-a8);
touch-action: none;
&:hover,
&[data-dragging="true"] {
background-color: var(--gray-a10);
}
}
&[data-axis="x"] .thumb {
top: var(--space-2);
height: var(--space-3);
}
&[data-axis="y"] .thumb {
left: var(--space-2);
width: var(--space-3);
}
}
/* Leaves the shared corner to neither bar */
&[data-orientation="both"] {
.bar[data-axis="x"] {
right: var(--space-4);
}
.bar[data-axis="y"] {
bottom: var(--space-4);
}
2026-10-13 20:53:15 -05:00
}
2026-10-13 20:40:47 -05:00
}