Skip to content

Commit

Permalink
added selected id
Browse files Browse the repository at this point in the history
  • Loading branch information
Frakits committed Sep 5, 2024
1 parent 6b7f373 commit 9602a66
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function buildHtml() {
for (i of filenames) {
var parsedName = path.parse(i);
var ext = parsedName.ext;
console.log(i);
if (ext == "" && !fs.existsSync("./export/" + realPath + i))
fs.mkdirSync("./export/" + realPath + i, {recursive: true});
if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif") {
Expand All @@ -67,8 +66,13 @@ function buildHtml() {
var vars = {
title: filename.replace(".md", ""),
content: renderer.render(fs.readFileSync("./src/docs/" + i, 'utf8')),
sidebar: sidebar
sidebar: sidebar.replace(`href="/${i.replace(".md", ".html").replaceAll("\\", "/")}"`, `href="/${i.replace(".md", ".html").replaceAll("\\", "/")}" id="selected"`)
};
console.log(i);
if (i == "/Modding The Engine/index.html") {
console.log(sidebar);
console.log(`href="/${i.replace(".md", ".html")}" id="selected"`);
}

var html = Mustache.render(templatePage, vars, null, {
escape: function(text) {
Expand Down
14 changes: 12 additions & 2 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ body {

.sidebar-wrapper {
width: fit-content;
display: inline-block;
}
.sidebar {
height: calc(100vh);
Expand Down Expand Up @@ -61,6 +62,9 @@ body {
.sidebar-list-item>a:hover {
background: rgba(255, 255, 255, 0.05);
}
.sidebar-list-item>#selected {
background: purple;
}

/*li:hover:not(:has(li:hover)) {
background: rgba(255, 255, 255, 0.05);
Expand Down Expand Up @@ -96,21 +100,27 @@ img {
}

.sidebar-wrapper {
position: sticky;
position: fixed;
top: 0;
left: 0;
width: 100%;
background: rgba(0, 0, 0, 0.7)
background: rgba(0, 0, 0, 0.7);
}

.sidebar {
display: none;
width: max-content;
position: fixed;
}

.container:has(.sidebar-button:checked) > .sidebar-wrapper > .sidebar {
display: inherit;
}

.container:has(.sidebar-button:checked) > .sidebar-wrapper {
height: 100%;
}

ul {
margin-top: 0;
list-style: none;
Expand Down

0 comments on commit 9602a66

Please sign in to comment.