hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2018-03-20T03:29:00.000120Z

hey, did anyone ever get a pattern/component library repo happening?

2018-03-20T03:52:49.000022Z

whelp, i'm going to put something super minimal at https://github.com/thedavidmeister/hoplon-elem-lib

2018-03-20T06:04:52.000179Z

ah well this is pretty sweet, if i do say so myself 😛

2018-03-20T06:05:03.000124Z

(defn elem
 [name desc f examples]
 (h/div
  :class/elem-lib "elem-lib-item"
  :id (camel-snake-kebab.core/->kebab-case-string name)

  (h/h2 name)
  (h/code (str f))
  (h/p desc)
  (h/for-tpl [[d & args] examples]
   (h/div :class/elem-lib "elem-lib-example"
    (h/h3 d)
    (h/for-tpl [arg args]
     (j/with-let [code-block (h/code)]
      (code-block
       :class/elem-lib "clojure"
       (let [arg' @arg]
        (j/formula-of
         [arg']
         (h/with-animation-frame (syntax-highlighter.hoplon/highlight! code-block))
         (pr-str @arg))))))
    (apply @f @args)))))

2018-03-20T06:05:32.000041Z

20 LOC elem library that has syntax highlighting and dynamic updating

2018-03-20T06:05:50.000061Z

(elem-lib.hoplon/elem
   "Simple div"
   "This is just a div produced by hoplon"
   #'h/div
   [["No args"]
    ["Hello world!" "Hello world!"]
    ["A cell" (j/cell "A cell")]
    ["Attributes and content" :class "some-class" "Hi!"]
    ["A counter" (j/with-let [c (j/cell 0)]
                  (h/with-interval 1000 (swap! c inc)))]])))

2018-03-20T06:23:48.000027Z

i'll get something up on clojars soonish