mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 07:09:31 +00:00
Use Karax html rendering instead of source filters (#2)
* Use Karax html rendering instead of source filters
This commit is contained in:
parent
fad2575d93
commit
ab36664ad2
21 changed files with 482 additions and 507 deletions
35
src/views/general.nim
Normal file
35
src/views/general.nim
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import karax/[karaxdsl, vdom]
|
||||
|
||||
const doctype = "<!DOCTYPE html>\n"
|
||||
|
||||
proc renderMain*(body: VNode; title="Nitter"): string =
|
||||
let node = buildHtml(html(lang="en")):
|
||||
head:
|
||||
title: text title
|
||||
link(rel="stylesheet", `type`="text/css", href="/style.css")
|
||||
|
||||
body:
|
||||
nav(id="nav", class="nav-bar container"):
|
||||
tdiv(class="inner-nav"):
|
||||
tdiv(class="item"):
|
||||
a(href="/", class="site-name"): text "nitter"
|
||||
|
||||
tdiv(id="content", class="container"):
|
||||
body
|
||||
|
||||
result = doctype & $node
|
||||
|
||||
proc renderSearch*(): VNode =
|
||||
buildHtml(tdiv(class="panel")):
|
||||
tdiv(class="search-panel"):
|
||||
form(`method`="post", action="search"):
|
||||
input(`type`="text", name="query", placeholder="Enter username...")
|
||||
button(`type`="submit"): text "🔎"
|
||||
|
||||
proc renderError*(error: string): VNode =
|
||||
buildHtml(tdiv(class="panel")):
|
||||
tdiv(class="error-panel"):
|
||||
span: text error
|
||||
|
||||
proc showError*(error: string): string =
|
||||
renderMain(renderError(error), title = "Error | Nitter")
|
||||
Loading…
Reference in a new issue