From f279e20468fb5323c33cbf43346c35ddef7f96e0 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 22 Feb 2026 15:25:50 +0100 Subject: Initial commit --- src/cashflow/frontend/utils.clj | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/cashflow/frontend/utils.clj (limited to 'src/cashflow/frontend/utils.clj') 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") "€"))]) + -- cgit v1.2.3