Help Garden

Powered by 🌱Roam Garden

(defn test [{:keys [block-uid]} & args]
  (let [*my-children (dr/pull '[{:block/children ...} 
                      :block/string 
                      :block/uid] 
                              [:block/uid block-uid])]
    (js/console.log args)
    (fn [& args]
      [:div 
        (doall (for [block (rest (tree-seq :block/uid :block/children @*my-children))]
          [:button.bp3-card
            {:style {:background-color (rand-nth color)}
             :on-click (fn [e] (js/alert (:block/uid block)))}
           (:block/string block)]))
        ])))

(defn test2 [{:keys [block-uid]} & args]
  (let [*my-children (dr/pull '[{:block/_refs ...}
                                {:block/children ...} 
                      :block/string 
                      :block/uid] 
                      [:node/title "TODO"])]
    (js/console.log args)
    (fn [& args]
      [:div 
        (doall (for [block (rest (tree-seq :block/uid :block/_refs @*my-children))]
          [:button.bp3-card.green
            {:style {:background-color (rand-nth color)}
             :on-click (fn [e] (js/alert (:block/uid block)))}
           (:block/string block)]))
        ])))
roam/render