Skip to content

Commit b895b37

Browse files
refactor menu toggle arrow
1 parent c8a13b7 commit b895b37

6 files changed

Lines changed: 25 additions & 7 deletions

File tree

_includes/api/en/3x/menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<button id="menu-toggle" title="show table of content">On this page <span>&#x25BA;</span></button>
1+
<button id="menu-toggle" title="show table of content">On this page</button>
22
<ul id="menu">
33
<li><a href="#express">express()</a></li>
44
<li id="app-api"> <a href="#application">Application</a>

_includes/api/en/4x/menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<button id="menu-toggle" title="show table of content">On this page <span>&#x25BA;</span></button>
1+
<button id="menu-toggle" title="show table of content">On this page</button>
22
<ul id="menu">
33
<li id="express-api"><a href="#express">express()</a>
44
<ul id="express-menu">

_includes/api/en/5x/menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<button id="menu-toggle" title="show table of content">On this page <span>&#x25BA;</span></button>
1+
<button id="menu-toggle" title="show table of content">On this page</button>
22
<ul id="menu">
33
<li id="express-api"><a href="#express">express()</a>
44
<ul id="express-menu">

_includes/blog/posts-menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<button id="menu-toggle" title="show blogs list">All Blogs <span>&#x25BA;</span></button>
1+
<button id="menu-toggle" title="show blogs list">All Blogs</button>
22
<ul id="menu" class="blog-side-menu">
33
<li>
44
<ul id="side-menu" class="active">

css/style.css

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,19 @@ h2 a {
11301130
color: #000;
11311131
background-color: #fff;
11321132

1133+
&::after {
1134+
content: "";
1135+
display: block;
1136+
width: 0.8em;
1137+
height: 0.5em;
1138+
background-color: var(--card-bg);
1139+
clip-path: polygon(100% 0%, 0 0%, 50% 100%);
1140+
cursor: pointer;
1141+
pointer-events: none;
1142+
transition: transform 0.2s ease-in-out;
1143+
transform: rotate(-90deg);
1144+
}
1145+
11331146
&:is(:hover, :active, :focus) {
11341147
background-color: #ebf2f5;
11351148
}
@@ -1331,10 +1344,16 @@ h2 a {
13311344
}
13321345

13331346
#menu-toggle.show {
1334-
display: block;
1347+
display: flex;
1348+
gap: 0.5rem;
1349+
align-items: center;
13351350
opacity: 1;
13361351
}
13371352

1353+
#menu-toggle.show.rotate::after {
1354+
transform: rotate(0deg);
1355+
}
1356+
13381357
#menu > li > a,
13391358
#menu ul a {
13401359
padding: 0.5rem;

js/menu.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ tocScreen.addEventListener("change", (event) => {
172172

173173
// Toggle toc menu on button click
174174
toggleBtn?.addEventListener("click", (e) => {
175+
toggleBtn.classList.toggle("rotate");
175176
if(tocList?.classList.contains("open")) {
176-
toggleBtn.children[0].innerHTML = "&#x25BA;";
177177
tocList.classList.remove("open");
178178
} else {
179-
toggleBtn.children[0].innerHTML = "&#x25BC;";
180179
tocList.classList.add("open");
181180
}
182181
});

0 commit comments

Comments
 (0)