A templ index template was added.
This commit is contained in:
parent
b05ddb6971
commit
bfbf5c42a6
@ -11,6 +11,7 @@
|
||||
--secondary-color: #9f2b68;
|
||||
--text-color: #f5f5f5;
|
||||
--text-indent: 1.6rem;
|
||||
color-scheme: light dark;
|
||||
--overlay-background-color: #f5f5f574;
|
||||
scrollbar-color: var(--primary-color) var(--background-color); }
|
||||
|
||||
@ -77,28 +78,25 @@ header {
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between; }
|
||||
|
||||
header svg { width: 360px; }
|
||||
|
||||
header svg text { fill: var(--text-color); }
|
||||
|
||||
header svg text:first-child {
|
||||
font-size: 2rem;
|
||||
font-size: 3.55rem;
|
||||
font-variant-caps: small-caps;
|
||||
font-weight: bold; }
|
||||
|
||||
header svg text:last-child { font-size: .88rem; }
|
||||
header svg text:last-child { font-size: 1.5rem; }
|
||||
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
header svg text:first-child { font-size: 2.082rem; } }
|
||||
@supports (-moz-appearance:none) {
|
||||
header svg text:last-child { transform: scale(.993, 1); } }
|
||||
|
||||
@-moz-document url-prefix() {
|
||||
header svg text:first-child { font-size: 2rem; } }
|
||||
header nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-variant: small-caps;
|
||||
justify-content: space-evenly; }
|
||||
|
||||
nav { margin-top: .5rem; }
|
||||
|
||||
nav a { font-variant: small-caps; }
|
||||
|
||||
nav h1 {
|
||||
header nav h1 {
|
||||
color: var(--secondary-color);
|
||||
margin: 0; }
|
||||
|
||||
@ -126,6 +124,8 @@ tr:focus-within {
|
||||
tr:hover a,
|
||||
tr:focus-within a { color: white; }
|
||||
|
||||
tr a { color: var(--text-color); }
|
||||
|
||||
th { text-align: left; }
|
||||
|
||||
th:nth-child(2),
|
||||
@ -205,26 +205,19 @@ thead tr th.clickable.sort-down::after { content: '↓'; }
|
||||
background-color: var(--background-color);
|
||||
color: var(--primary-color); }
|
||||
|
||||
#error {
|
||||
font-size: 3.5rem;
|
||||
line-height: 5rem;
|
||||
text-align: center;
|
||||
margin: 6rem 0; }
|
||||
|
||||
#error h1 { font-size: 8rem; }
|
||||
|
||||
footer {
|
||||
font-size: .8rem;
|
||||
text-align: center;
|
||||
padding: 1rem 0; }
|
||||
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
header { display: block; }
|
||||
header {
|
||||
align-items: center;
|
||||
flex-direction: column; }
|
||||
|
||||
header svg {
|
||||
margin: 0 auto;
|
||||
width: 100%; }
|
||||
header svg { width: 100%; }
|
||||
|
||||
nav {
|
||||
header nav {
|
||||
width: 100%;
|
||||
text-align: center; } }
|
97
web/index.templ
Normal file
97
web/index.templ
Normal file
@ -0,0 +1,97 @@
|
||||
package web
|
||||
|
||||
import "github.com/invopop/ctxi18n/i18n"
|
||||
import "net/http"
|
||||
import "dwelling-files/pkg/files"
|
||||
import "dwelling-files/pkg/utils"
|
||||
import "strconv"
|
||||
|
||||
|
||||
templ Index(currentPath, progVer string, stat *files.DirStat, entries *[]files.DirEntry, r *http.Request) {
|
||||
<!doctype html>
|
||||
<html lang={ i18n.GetLocale(ctx).Code().String() }>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#cd2682" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
|
||||
<title>Arav's dwelling / { i18n.T(ctx, "title") }</title>
|
||||
|
||||
<meta name="description" content={ i18n.T(ctx, "description") } />
|
||||
<meta name="keywords" content={ i18n.T(ctx, "keywords") } />
|
||||
|
||||
<link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/>
|
||||
<link rel="stylesheet" href="/assets/css/main.css" />
|
||||
<script src="/assets/js/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<svg width="360" viewBox="0 -36 360 66">
|
||||
<text y="7" textLength="360" lengthAdjust="spacingAndGlyphs">Arav's dwelling</text>
|
||||
<text y="25" textLength="360" lengthAdjust="spacingAndGlyphs">Welcome to my sacred place, wanderer</text>
|
||||
</svg>
|
||||
<nav>
|
||||
<a href={ templ.SafeURL(utils.MainSite(r.Host)) }>{ i18n.T(ctx, "back-home") }</a>
|
||||
<h1>{ i18n.T(ctx, "title") }</h1>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
<section>
|
||||
<span>@templ.Raw(currentPath)</span>
|
||||
<p>{ i18n.T(ctx, "stats.files") }: { strconv.FormatInt(stat.Files, 10) } ({ stat.FilesSize }); { i18n.T(ctx, "stats.directories") }: { strconv.FormatInt(stat.Directories, 10) }.</p>
|
||||
<input type="text" name="filter" placeholder={ i18n.T(ctx, "stats.filter") } class="hidden">
|
||||
</section>
|
||||
<section>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{ i18n.T(ctx, "table.name") }</th>
|
||||
<th>{ i18n.T(ctx, "table.date") }</th>
|
||||
<th>{ i18n.T(ctx, "table.size") }</th>
|
||||
</tr>
|
||||
<tr tabindex="0">
|
||||
<td><a href="../">../</a></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
for i, entry := range *entries {
|
||||
<tr tabindex={ strconv.FormatInt(int64(i)+1, 10) }>
|
||||
<td><a href={ templ.SafeURL(entry.Link) }>{ entry.Name }</a></td>
|
||||
<td>{ utils.ToClientTimezone(entry.Datetime, r).Format(files.FileDateFormat) }</td>
|
||||
<td>{ entry.Size }</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<section>
|
||||
<span>@templ.Raw(currentPath)</span>
|
||||
</section>
|
||||
<noscript>
|
||||
<section>
|
||||
<p>{ i18n.T(ctx, "no-script-explain") }</p>
|
||||
</section>
|
||||
</noscript>
|
||||
<section id="instruction" class="hidden">
|
||||
<p></p>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<a href="?lang=ru">рус</a>
|
||||
<a href="?lang=en">eng</a>
|
||||
<br/>
|
||||
v{ progVer } 2017—2024 { i18n.T(ctx, "footer.author") } <<a href="mailto:me@arav.su">me@arav.su</a>> <a href={ templ.SafeURL(utils.MainSite(r.Host) + "/privacy") }>{ i18n.T(ctx, "footer.privacy") }</a>
|
||||
</footer>
|
||||
<div id="overlay">
|
||||
<button name="prev">❰</button>
|
||||
<div>
|
||||
<div></div>
|
||||
<span></span>
|
||||
</div>
|
||||
<button name="prev">❱</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
}
|
Loading…
Reference in New Issue
Block a user