commit: 593aeee54d901cfe44c9ccbe64dcf382190c509d
parent: 8f7a850c088e061ac918d64446e09bbb9b6cbd63
author: Chris Noxz <chris@noxz.tech>
date: Fri, 25 Oct 2019 23:43:27 +0200
[backend] Render menu 'icons' in css instead of as text
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/builder.c b/builder.c
@@ -215,14 +215,15 @@ void nav(char *domain, char *page, char *this)
if (build_ignore(domain, newdir) == 0)
continue;
- fputs("\t<li><a", stdout);
+ fputs("\t<li", stdout);
if (page && !strncmp(newdir, page, strlen(newdir)))
fputs(" class=\"active\"", stdout);
- printf(" href=\"//%s/%s/\">", domain, newdir);
- if (page && !strncmp(newdir, page, strlen(newdir)))
- fputs("» ", stdout);
- else
- fputs("› ", stdout);
+ fputs(">", stdout);
+ printf("<a href=\"//%s/%s/\">", domain, newdir);
+ //if (page && !strncmp(newdir, page, strlen(newdir)))
+ // fputs("» ", stdout);
+ //else
+ // fputs("› ", stdout);
print_name(*d);
fputs("</a>", stdout);
@@ -241,10 +242,11 @@ void print_nav(char *domain, char *page)
(void)domain;
(void)page;
- fputs("<div id=\"nav\">\n\t<ul>\n\t<li><a", stdout);
+ fputs("<div id=\"nav\">\n\t<ul>\n\t<li", stdout);
if (!page)
fputs(" class=\"active\"", stdout);
- fputs(" href=\"/\">home</a></li>", stdout);
+ fputs(">", stdout);
+ fputs("<a href=\"/\">home</a></li>", stdout);
nav(domain, page, NULL);
fputs("\t</ul>", stdout);
fputs("\t<a class=\"rss\" href=\"/pub/feed.rss\" target=\"_blank\">"
diff --git a/noxz.tech/pub/style.css b/noxz.tech/pub/style.css
@@ -125,6 +125,17 @@ pre code {
margin : 0;
}
+#nav li>a:before {
+ content : "\203A";
+ display : inline-block;
+ margin-left : -1em;
+ width : 1em;
+}
+
+#nav li.active>a:before {
+ content : "\00BB";
+}
+
#nav li ul {
padding-left : 0.6em !important;
}
@@ -132,7 +143,8 @@ pre code {
#nav li a {
display : block;
margin : 0;
- padding : 0.8ex 2em 0.8ex 1em;
+ padding : 0.8ex 2em 0.8ex 2em;
+ line-height : 3ex;
}
#nav li a:hover {
@@ -140,7 +152,7 @@ pre code {
text-decoration : none;
}
-#nav li a.active {
+#nav li.active>a {
color : #222;
font-weight : bold;
}