Skip to content

Commit 8914057

Browse files
committed
feat(ui): enhance scrollbar and navbar styling
• Add custom scrollbar styles for markdown content • Adjust main scrollbar width and height • Implement smooth transition for navbar during page navigation • Remove unused fade-in-down animation • Update navbar drawer height to use dynamic viewport height
1 parent 52a11fb commit 8914057

File tree

6 files changed

+64
-39
lines changed

6 files changed

+64
-39
lines changed

layout/_partials/navbar.ejs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<header class="navbar-container px-6 md:px-12">
2-
3-
<div class="navbar-content <%- (theme.home_banner.enable === true && is_home() && !page.prev) ? 'has-home-banner' : '' %>">
2+
<div class="navbar-content transition-navbar <%- (theme.home_banner.enable === true && is_home() && !page.prev) ? 'has-home-banner' : '' %>">
43
<div class="left">
54
<% if (theme.defaults.hasOwnProperty('logo') && theme.defaults.logo) { %>
65
<a class="logo-image h-8 w-8 sm:w-10 sm:h-10 mr-3" href="<%= config.root %>">
@@ -79,7 +78,7 @@
7978
</div>
8079

8180
<!-- Mobile sheet -->
82-
<div class="navbar-drawer h-screen w-full absolute top-0 left-0 bg-background-color flex flex-col justify-between">
81+
<div class="navbar-drawer h-dvh w-full absolute top-0 left-0 bg-background-color flex flex-col justify-between">
8382
<ul class="drawer-navbar-list flex flex-col px-4 justify-center items-start">
8483
<% for (let i in theme.navbar.links) { %>
8584
<% if (theme.navbar.links[i].path !== 'none') { %>

source/css/common/animated.styl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ transition-t(property, delay, duration, function)
2727
transition-duration convert($temp-duration)
2828
transition-timing-function convert($temp-function)
2929

30-
.fade-in-down-animation
31-
animation-fill-mode both
32-
animation-duration 1s
33-
animation-name fade-in-down
34-
will-change transform
3530

3631
@keyframes fade-in-down
3732
0%

source/css/common/basic.styl

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,25 @@ redefine-mobile()
1515
*
1616
transition-g()
1717

18+
19+
// html, body
20+
html, body
21+
position relative
22+
width 100%
23+
height 100%
24+
margin 0
25+
padding 0
26+
color var(--default-text-color)
27+
background var(--background-color)
28+
font-family $default-font-family
29+
font-weight $default-font-weight
30+
font-size $default-font-size
31+
line-height $default-line-height
32+
1833
// Custom scrollbar
1934
&::-webkit-scrollbar
20-
width 6px
21-
height 6px
35+
width 14px
36+
height 8px
2237
transition all 0.2s ease
2338
display block
2439

@@ -38,24 +53,6 @@ redefine-mobile()
3853
background-clip content-box
3954
border 3px solid transparent
4055

41-
// html, body
42-
html, body
43-
position relative
44-
width 100%
45-
height 100%
46-
margin 0
47-
padding 0
48-
color var(--default-text-color)
49-
background var(--background-color)
50-
font-family $default-font-family
51-
font-weight $default-font-weight
52-
font-size $default-font-size
53-
line-height $default-line-height
54-
55-
&::-webkit-scrollbar
56-
width 14px
57-
height 8px
58-
5956
+redefine-tablet()
6057
font-size: $default-font-size * 0.96
6158
line-height: $default-line-height * 0.96

source/css/common/markdown.styl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,23 @@
251251
text-align center /* Center the content */
252252
padding-bottom 8px
253253

254+
&:hover::-webkit-scrollbar-thumb
255+
border 3px solid rgba(183, 183, 183, 0.3)
256+
257+
&::-webkit-scrollbar
258+
width 6px
259+
height 6px
260+
transition all 0.2s ease
261+
display block
262+
263+
&::-webkit-scrollbar-track
264+
background transparent
265+
border none
266+
267+
&::-webkit-scrollbar-thumb
268+
border-radius 20px
269+
border 3px solid rgba(183, 183, 183, 0)
270+
transition all 0.2s ease
254271

255272
svg
256273
display inline-block /* Allow content to be centered properly */
@@ -262,5 +279,24 @@
262279
overflow-x auto
263280
text-align center
264281

282+
&:hover::-webkit-scrollbar-thumb
283+
border 3px solid rgba(183, 183, 183, 0.3)
284+
285+
&::-webkit-scrollbar
286+
width 6px
287+
height 6px
288+
transition all 0.2s ease
289+
display block
290+
291+
&::-webkit-scrollbar-track
292+
background transparent
293+
border none
294+
295+
&::-webkit-scrollbar-thumb
296+
border-radius 20px
297+
border 3px solid rgba(183, 183, 183, 0)
298+
transition all 0.2s ease
299+
300+
265301
svg
266302
display inline-block

source/css/layout/_partials/navbar.styl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,11 @@ $logo-image-box-width = 34px
308308
.icon-rotated {
309309
transform: rotate(90deg);
310310
}
311+
312+
.transition-navbar
313+
transition max-width 0.3s ease-out
314+
315+
html.is-animating
316+
.transition-navbar
317+
max-width $navbar-width-pages !important
318+
transition max-width 0.2s ease-out

source/css/layout/page.styl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,7 @@
140140
transition 0.4s
141141
opacity 1
142142

143-
.transition-navbar
144-
transition 0.3s ease
145-
transform translateY(0)
146-
opacity 1
147-
148143
html.is-animating
149144
.transition-fade
150145
opacity 0
151-
transition 0.4s
152-
153-
.transition-navbar
154-
transform translateY(-105%)
155-
opacity 0
156-
transition 0.3s ease
146+
transition 0.4s

0 commit comments

Comments
 (0)