Fork me on GitHub
#portal
<
2021-05-28
>
plexus07:05:48

This is just delightful

(defn hiccup [html]
  (with-meta
    html
    {:portal.viewer/default :portal.viewer/hiccup}))

(defn pixel-grid [pixels]
  (hiccup
   [:div {:style {:display "flex"}}
    (for [col pixels]
      [:div {:style {:display "flex" :flex-direction "column"}}
       (for [color col]
         [:div {:style {:width "5px" :height "5px" :background-color (str "rgba(" (str/join "," color) ")")}}])])]))

(tap> (pixel-grid (:pixels @state)))

🆒 12
awesome 6
djblue16:05:30

Since reagent is rendering this, I wonder if you still need a :key on list elements :thinking_face:

plexus18:05:18

You never really need that, right?

djblue18:05:28

You would need it if you are updating large lists, but most of the time you can get by without it 👌

plexus18:05:39

And since in this case you won't get updates it won't matter in terms of performance either

plexus18:05:41

Right, what you said :)