diff options
| author | Tim <contact@bytim.eu> | 2026-02-22 15:25:50 +0100 |
|---|---|---|
| committer | Tim <contact@bytim.eu> | 2026-02-22 15:25:50 +0100 |
| commit | f279e20468fb5323c33cbf43346c35ddef7f96e0 (patch) | |
| tree | c488ee2791296917367f704524fa8e41a0b518ea /src/cashflow/frontend/utils.clj | |
Initial commit
Diffstat (limited to 'src/cashflow/frontend/utils.clj')
| -rw-r--r-- | src/cashflow/frontend/utils.clj | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cashflow/frontend/utils.clj b/src/cashflow/frontend/utils.clj new file mode 100644 index 0000000..25091a6 --- /dev/null +++ b/src/cashflow/frontend/utils.clj @@ -0,0 +1,32 @@ +(ns cashflow.frontend.utils + (:require [hiccup2.core :as html] + [dotenv :as env])) + +(defn render-component [component] + (-> component + html/html + str)) + +(defn render-page [title & body] + (-> [:html + [:head + [:meta {:name "viewport" :content "width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"}] + [:meta {:charset "UTF-8"}] + [:title title] + [:link {:rel "stylesheet" :href "/static/style.css"}] + [:link {:rel "stylesheet" :href "/static/beer.css"}] + [:meta {:name "robots" :content "noindex,nofollow"}]] + (apply conj [:body] body [[:script {:src "/static/beer.js"}] + [:script {:src "/static/htmx.js"}] + [:script {:src "/static/hyperscript.js"}]])] + render-component)) + +(defn render-amount [amount] + [:p {:style {:color (cond + (pos? amount) :limegreen + (neg? amount) :red + :else :orange)}} + (str (when (pos? amount) "+") + amount + (or (env/env "CONCURRENCY") "€"))]) + |
