Skip to content

Commit

Permalink
NEW: Make search results table header sticky (#127)
Browse files Browse the repository at this point in the history
closes #127
  • Loading branch information
dwhieb committed Jul 13, 2024
1 parent 7e2af2d commit 9fae914
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
28 changes: 14 additions & 14 deletions layouts/main/styles/utilities.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
/* https://lea.verou.me/blog/2012/04/background-attachment-local/ */
.scroll-shadow {
background: linear-gradient(to right, white 30%, rgb(255 255 255 / 0%)),
linear-gradient(to right, rgb(255 255 255 / 0%), white 70%) 0 100%,
radial-gradient(
farthest-side at 0% 50%,
rgb(0 0 0 / 20%),
rgb(0 0 0 / 0%)
),
radial-gradient(
farthest-side at 100% 50%,
linear-gradient(to right, rgb(255 255 255 / 0%), white 70%) 0 100%,
radial-gradient(
farthest-side at 0% 50%,
rgb(0 0 0 / 20%),
rgb(0 0 0 / 0%)
)
0 100%;
background-repeat: no-repeat;
background-color: white;
background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
background-position: 0 0, 100%, 0 0, 100%;
),
radial-gradient(
farthest-side at 100% 50%,
rgb(0 0 0 / 20%),
rgb(0 0 0 / 0%)
)
0 100%;
background-repeat: no-repeat;
background-color: white;
background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
background-position: 0 0, 100%, 0 0, 100%;
background-attachment: local, local, scroll, scroll;
}

Expand Down
24 changes: 23 additions & 1 deletion pages/Search/Search.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ h2 {

.results {

border-collapse: separate; /* This is necessary for borders to stay fixed with position: sticky */
margin: 0;
min-inline-size: 100%;

& td {
border-block: var(--cell-border)
border-block-end: var(--cell-border);
}

& th {
Expand All @@ -117,6 +118,27 @@ h2 {
padding: var(--text-padding);
}

& thead {

background-color: white;
position: sticky;
top: 0;
z-index: 2;

@media (prefers-color-scheme: dark) {
background-color: var(--off-black);
}

}

& thead tr:last-child {
box-shadow: 0px 5px 5px -5px rgb(0 0 0 / 50%);
}

& thead tr:last-child th {
border-block-end: 1px solid black;
}

}

.results-info {
Expand Down

0 comments on commit 9fae914

Please sign in to comment.