Skip to content

Commit

Permalink
doc,tools: replace bullet triangle with pure css design
Browse files Browse the repository at this point in the history
Removed the hardcoded triangle from doc/template.html and
tools/doc/html.mjs and placed the new <span> element which
takes the shape of triangle using the new style defined in css.
  • Loading branch information
Akash Yeole committed Mar 24, 2024
1 parent 2839ea8 commit be7b414
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
47 changes: 25 additions & 22 deletions doc/api_assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -182,29 +182,32 @@ li.picker-header {
position: relative;
}

li.picker-header .collapsed-arrow, li.picker-header .expanded-arrow {
position: relative;
bottom: 0.2rem;
width: 1.5ch;
height: 1.5em;
}

li.picker-header .collapsed-arrow {
display: inline-block;
}

li.picker-header .expanded-arrow {
display: none;
}

li.picker-header.expanded .collapsed-arrow,
:root:not(.has-js) li.picker-header:hover .collapsed-arrow {
display: none;
}

li.picker-header.expanded .expanded-arrow,
:root:not(.has-js) li.picker-header:hover .expanded-arrow {
li.picker-header .picker-arrow {
display: inline-block;
width: .6rem;
height: .6rem;
border-top: .3rem solid transparent;
border-bottom: .3rem solid transparent;
border-left: .6rem solid var(--color-links);
border-right: none;
margin: 0 .2rem .05rem 0;
}

li.picker-header a:focus .picker-arrow,
li.picker-header a:active .picker-arrow,
li.picker-header a:hover .picker-arrow {
border-left: .6rem solid var(--white);
}

li.picker-header.expanded a:focus .picker-arrow,
li.picker-header.expanded a:active .picker-arrow,
li.picker-header.expanded a:hover .picker-arrow,
:root:not(.has-js) li.picker-header:hover .picker-arrow {
border-top: .6rem solid var(--white);
border-bottom: none;
border-left: .35rem solid transparent;
border-right: .35rem solid transparent;
margin-bottom: 0;
}

li.picker-header.expanded > a,
Expand Down
2 changes: 1 addition & 1 deletion doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h1>Node.js __VERSION__ documentation</h1>
__ALTDOCS__
<li class="picker-header">
<a href="#">
<span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
<span class="picker-arrow"></span>
Options
</a>

Expand Down
6 changes: 3 additions & 3 deletions tools/doc/html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ function altDocs(filename, docCreated, versions) {
return list ? `
<li class="picker-header">
<a href="#">
<span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
<span class="picker-arrow"></span>
Other versions
</a>
<div class="picker"><ol id="alt-docs">${list}</ol></div>
Expand Down Expand Up @@ -558,7 +558,7 @@ function gtocPicker(id) {
return `
<li class="picker-header">
<a href="#">
<span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
<span class="picker-arrow"></span>
Index
</a>
Expand All @@ -575,7 +575,7 @@ function tocPicker(id, content) {
return `
<li class="picker-header">
<a href="#">
<span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
<span class="picker-arrow"></span>
Table of contents
</a>
Expand Down

0 comments on commit be7b414

Please sign in to comment.