Skip to content

Commit a42a322

Browse files
History View: Add scrollbar to Sidebar (#1689)
* feat: Add scrollbar to Sidebar * cleanups * fix: cleanup on main * chore: style fix * chore: last style fix * chore: Move styles back to App.module.css * chore: Adjust code * fix: visual regression test * fix: Reduce sidebar padding * cache bust netlify * chore: reduce sidebar width (revert pkg.json change) * added changed snapshots --------- Co-authored-by: Shane Osbourne <[email protected]>
1 parent 3996136 commit a42a322

File tree

8 files changed

+40
-11
lines changed

8 files changed

+40
-11
lines changed

special-pages/pages/history/app/components/App.module.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ body {
3636
height: 100vh;
3737
background-color: var(--history-background-color);
3838
}
39+
3940
.header {
4041
grid-area: header;
4142
padding-left: var(--main-padding-left);
@@ -44,14 +45,19 @@ body {
4445
z-index: 1;
4546
background-color: var(--history-background-color);
4647
}
48+
4749
.search {
4850
justify-self: flex-end;
4951
}
52+
5053
.aside {
5154
grid-area: aside;
5255
padding: 10px 16px;
56+
/* Nav child will handle this to accommodate a scrollbar */
57+
padding-right: 0;
5358
border-right: 1px solid var(--history-surface-border-color);
5459
}
60+
5561
.main {
5662
grid-area: main;
5763
overflow: auto;
@@ -60,6 +66,10 @@ body {
6066
padding-top: 24px;
6167
}
6268

69+
/**
70+
* The scrollbar is a custom scroller that is used in the main
71+
* content area and the sidebar nav.
72+
*/
6373
.customScroller {
6474
overflow-y: scroll;
6575
padding-right: calc(var(--main-padding-right) - var(--scrollbar-width));
@@ -70,6 +80,7 @@ body {
7080
*/
7181
[data-platform="windows"] {
7282
.customScroller {
83+
overflow-y: auto;
7384
scrollbar-gutter: stable;
7485
scrollbar-width: var(--scrollbar-width);
7586
scrollbar-color: var(--history-scrollbar-controls-color) var(--history-background-color);
@@ -80,6 +91,7 @@ body {
8091
* macOS specific styling to handle dark mode - without this full
8192
* override you cannot change the track color :(
8293
*/
94+
[data-platform="integration"],
8395
[data-platform="macos"] {
8496
.customScroller {
8597
--webkit-thumb-color: rgba(136, 136, 136, 0.8);
@@ -116,4 +128,4 @@ body {
116128

117129
.paddedErrorRecovery {
118130
margin-top: 1rem;
119-
}
131+
}

special-pages/pages/history/app/components/Sidebar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { h } from 'preact';
22
import cn from 'classnames';
33
import styles from './Sidebar.module.css';
4+
import AppStyles from './App.module.css';
45
import { useComputed } from '@preact/signals';
56
import { useTypedTranslation } from '../types.js';
67
import { Trash } from '../icons/Trash.js';
@@ -77,7 +78,7 @@ export function Sidebar({ ranges }) {
7778
return (
7879
<div class={styles.stack}>
7980
<h1 class={styles.pageTitle}>{t('page_title')}</h1>
80-
<nav class={styles.nav}>
81+
<nav class={cn(styles.nav, AppStyles.customScroller)}>
8182
{ranges.value.map((range) => {
8283
return (
8384
<Item key={range.id} onClick={onClick} onDelete={onDelete} current={current} range={range.id} count={range.count} />

special-pages/pages/history/app/components/Sidebar.module.css

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
11
.stack {
22
display: flex;
33
flex-direction: column;
4-
> * {
4+
height: 100%;
5+
6+
>* {
57
min-width: 0
68
}
9+
710
gap: 24px;
811
}
12+
913
.pageTitle {
1014
color: var(--history-text-normal);
1115
font-size: var(--title-font-size);
1216
font-weight: var(--title-font-weight);
1317
line-height: 24px;
1418
padding: 10px 6px 10px 10px;
1519
}
16-
.nav {}
20+
21+
.nav {
22+
padding-right: 0;
23+
}
24+
1725
.item {
1826
position: relative;
1927
border-radius: 8px;
2028
display: flex;
2129

22-
&:hover, &:focus-visible {
30+
&:hover,
31+
&:focus-visible {
2332
background: var(--color-black-at-6);
2433
}
2534

26-
[data-theme="dark"] & {
27-
&:hover, &:focus-visible {
35+
[data-theme="dark"] & {
36+
37+
&:hover,
38+
&:focus-visible {
2839
background: var(--color-white-at-6);
2940
}
3041
}
@@ -37,12 +48,14 @@
3748

3849
.active {
3950
background: var(--color-black-at-12);
51+
4052
&:hover {
4153
background: var(--color-black-at-18);
4254
}
4355

44-
[data-theme="dark"] & {
56+
[data-theme="dark"] & {
4557
background: var(--color-white-at-9);
58+
4659
&:hover {
4760
background: var(--color-white-at-12);
4861
}
@@ -88,7 +101,9 @@
88101
color: var(--history-text-normal);
89102

90103
&:not([aria-disabled="true"]) {
91-
&:hover, &:focus-visible {
104+
105+
&:hover,
106+
&:focus-visible {
92107
background: var(--color-black-at-9);
93108
opacity: 1;
94109
}
@@ -102,6 +117,7 @@
102117
&:hover {
103118
background: var(--color-white-at-9);
104119
}
120+
105121
&:active {
106122
background: var(--color-white-at-12);
107123
}
@@ -111,7 +127,7 @@
111127
opacity: 1;
112128
}
113129

114-
.link:focus-visible + & {
130+
.link:focus-visible+& {
115131
opacity: 1;
116132
}
117133

Loading
Loading
Loading
Loading

special-pages/pages/history/styles/history-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ body {
6767
--history-text-normal: var(--color-white-at-84);
6868
--history-text-invert: var(--color-black-at-84);
6969
--history-text-muted: var(--color-white-at-60);
70-
}
70+
}

0 commit comments

Comments
 (0)