added pretty icons for navigation in CSS

This commit is contained in:
Andrey Parhomenko 2024-03-04 04:05:42 +05:00
parent 17e20579a0
commit 7fe10f4d66
2 changed files with 51 additions and 14 deletions

View file

@ -105,11 +105,17 @@ func (srv *Server) ProcessToHtml(urlPath, filePath string, bts []byte) ([]byte,
return nil, err return nil, err
} }
fmt.Fprint(&b, "<header><nav class=\"base\">") fmt.Fprint(&b, "<header>")
fmt.Fprint(&b, "<nav class=\"base\">")
fmt.Fprintf( fmt.Fprintf(
&b, "<a href=\"..\">&lt&lt&lt</a><a href=\".\">%s</a>", &b, "<a class=\"prev\" href=\"..\">"+
"&lt&lt&lt</a>"+
"<a class=\"home\"href=\".\">%s</a>",
srv.makeFileName(fileDirPath, "index"+srv.options.WikiExt), srv.makeFileName(fileDirPath, "index"+srv.options.WikiExt),
) )
fmt.Fprint(&b, "</nav>")
fmt.Fprint(&b, "<nav class=\"dirs\">") fmt.Fprint(&b, "<nav class=\"dirs\">")
for _, entry := range entries { for _, entry := range entries {
if !entry.IsDir() { if !entry.IsDir() {
@ -121,8 +127,6 @@ func (srv *Server) ProcessToHtml(urlPath, filePath string, bts []byte) ([]byte,
srv.makeFileName(fileDirPath, entry.Name()), srv.makeFileName(fileDirPath, entry.Name()),
) )
} }
fmt.Fprint(&b, "</nav>")
fmt.Fprint(&b, "</nav>") fmt.Fprint(&b, "</nav>")
fmt.Fprint(&b, "<nav class=\"files\">") fmt.Fprint(&b, "<nav class=\"files\">")

View file

@ -23,7 +23,7 @@ table, th, td {
border: var(--bd-width) var(--bd-style) var(--bd-color); border: var(--bd-width) var(--bd-style) var(--bd-color);
} }
h2:after, h3:after { h2::after, h3::after {
display : block ; display : block ;
content: ''; content: '';
margin-top: 0.2rem; margin-top: 0.2rem;
@ -37,9 +37,12 @@ h2:after, h3:after {
--bd-color: gray; --bd-color: gray;
--bd-width: .15rem; --bd-width: .15rem;
--bd-style: solid; --bd-style: solid;
--border: var(--bd-width) var(--bd-style) var(--bd-color);
--hv-fg-color: white; --hv-fg-color: white;
--hv-bg-color: silver; --hv-bg-color: silver;
--header-bg: whitesmoke;
--header-width: 6rem; --header-width: 6rem;
} }
@ -60,20 +63,15 @@ body {
/*gap: 1rem;*/ /*gap: 1rem;*/
} }
@media screen and (max-width: 480px) {
body {
flex-direction: column;
position: static;
}
}
header { header {
background: var(--header-bg);
max-width: fit-content; max-width: fit-content;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
border-right: var(--bd-width) var(--bd-style) var(--bd-color); border-right: var(--border);
border-bottom: var(--border);
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
flex-shrink: 1; flex-shrink: 1;
@ -81,11 +79,24 @@ header {
resize: horizontal; resize: horizontal;
} }
@media screen and (max-width: 480px) {
body {
flex-direction: column;
position: static;
}
header {
width: 100%;
max-width: 100%;
resize: none;
}
}
header > nav { header > nav {
padding-left: .25rem; padding-left: .25rem;
padding-top: 1rem; padding-top: 1rem;
padding-bottom: 1rem; padding-bottom: 1rem;
border-bottom: var(--bd-width) var(--bd-style) var(--bd-color); width: 100%;
border-bottom: var(--border);
} }
nav { nav {
@ -104,3 +115,25 @@ main {
overflow-y: auto; overflow-y: auto;
} }
a {
text-decoration: none;
}
nav.base > a.prev::before {
content: '⏎';
}
nav.base > a.home::before {
content: '🏠';
}
nav.dirs > a::before {
content: '🗀 ';
}
nav.files > a::before {
content: '🗎 ';
}
nav.document a::before {
content: '🕮 ';
}