Skip to content

Commit 33b04a5

Browse files
Added: beautiful aesthetic design to scrollbar (#429)
* Added: beautiful aesthetic design to scrollbar * Implemented: dynamic styling of scrollbar * Fixed: re-rendering of scrollbar * FIxed: formatting spacing
1 parent d915e3d commit 33b04a5

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/containers/Main.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ import Error404 from "../pages/errors/error404/Error";
1212
import ResumePage from "../pages/resume/Resume.js";
1313

1414
export default class Main extends Component {
15+
componentDidMount() {
16+
document.documentElement.style.setProperty(
17+
"--scrollbar-color",
18+
this.props.theme.imageHighlight
19+
);
20+
}
21+
componentDidUpdate(prevProps) {
22+
if (
23+
prevProps.theme &&
24+
this.props.theme &&
25+
prevProps.theme.imageHighlight !== this.props.theme.imageHighlight
26+
) {
27+
document.documentElement.style.setProperty(
28+
"--scrollbar-color",
29+
this.props.theme.imageHighlight
30+
);
31+
}
32+
}
1533
render() {
1634
return (
1735
<BrowserRouter basename="/">

src/index.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ body {
6363
line-height: normal;
6464
}
6565
}
66+
67+
:root {
68+
--scrollbar-color: white; /* it will change when the page loads*/
69+
}
70+
* {
71+
scrollbar-width: thin;
72+
scrollbar-color: var(--scrollbar-color) transparent;
73+
}

0 commit comments

Comments
 (0)