(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") "€"))])