Commit 7f09dfe7 authored by Bruno Burke's avatar Bruno Burke 😁

fallback for old icon component

parent 47451ca0
Pipeline #45182 passed with stages
in 1 minute and 52 seconds
(ns lernmeister.components.bulma.common
(:require [clojure.string :refer [join]]))
(defn icon [{:keys [class size position id]}]
(defn icon [{:keys [class size position id] :as options}]
;;;TODO check if this makes sense. Use ligature as key to force 'font awesome' to re-render
(let [component-id (gensym "icon")]
(fn [{:keys [class i-class size position style id]
:or {style :fas}}]
:or {style :fas} :as options}]
^{:key (str component-id)}
[:span.icon {:class (join " "
[class
......@@ -17,13 +17,15 @@
:small "is-small"
"")])}
[:i {:class
(join " " [i-class
(case style
:solid "fas"
:regular "far"
:light "fal"
:brand "fab"
"")
(name style)
(when id
(name id))])}]])))
(if (string? options) ;;; fallback for old icon component
(str "fas " options)
(join " " [i-class
(case style
:solid "fas"
:regular "far"
:light "fal"
:brand "fab"
"")
(name style)
(when id
(name id))]))}]])))
......@@ -62,7 +62,8 @@
(when-not result
[:a.button
{:on-click #(on-change-fn (add-answer exercise answer ""))}
[ui/icon "fa-plus"]])]]))
[ui/icon {:style :solid
:id "fa-plus"}]])]]))
(defn print-list-exercise [exercise & {:keys [result answer on-change-fn]}]
(fn [exercise & {:keys [result answer on-change-fn]}]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment