nitter/src/views/general.nimf

50 lines
1.1 KiB
Text
Raw Normal View History

2019-06-20 14:16:20 +00:00
#? stdtmpl(subsChar = '$', metaChar = '#')
#import xmltree
#
2019-06-24 20:40:48 +00:00
#proc renderMain*(body: string; title="Nitter"): string =
2019-06-20 14:16:20 +00:00
<!DOCTYPE html>
2019-06-25 02:52:38 +00:00
<html lang="en">
2019-06-20 14:16:20 +00:00
<head>
2019-06-24 20:40:48 +00:00
<title>${xmltree.escape(title)}</title>
2019-06-20 14:16:20 +00:00
<link rel="stylesheet" type="text/css" href="/style.css">
</head>
<body>
<nav id="nav" class="nav-bar container">
<div class="inner-nav">
<div class="item">
2019-06-20 15:58:31 +00:00
<a href="/" class="site-name">nitter</a>
2019-06-20 14:16:20 +00:00
</div>
</div>
</nav>
<div id="content" class="container">
${body}
</div>
</body>
</html>
#end proc
#
#proc renderSearchPanel*(): string =
<div class="panel">
<div class="search-panel">
<form action="search" method="post">
<input type="text" name="query" placeholder="Enter username...">
<button type="submit" name="button">🔎</button>
</form>
</div>
</div>
#end proc
#
#proc renderError*(error: string): string =
<div class="panel">
<div class="error-panel">
<span>${error}</span>
</div>
</div>
#end proc
#
#proc showError*(error: string): string =
2019-06-24 20:40:48 +00:00
${renderMain(renderError(error), title="Error | Nitter")}
2019-06-20 14:16:20 +00:00
#end proc