devcards icon indicating copy to clipboard operation
devcards copied to clipboard

Added DataScript rendering support

Open alexandergunnarson opened this issue 9 years ago • 4 comments

  • Added two lines of code in core.cljs in order to add the :render-fn parameter to e.g. defcard-rg
  • Added one function to util/utils.cljs — ds->seq — in order to correctly render DataScript databases via Devcards. Provided documentation for this

alexandergunnarson avatar Feb 08 '16 07:02 alexandergunnarson

@bhauman ,

@Conaws (Conor White-Sullivan) reached out to you on Twitter a few weeks back (his handle there is @Conaw) and talked about possibly doing a pull request to support DataScript rendering. Here it is.

The description and documentation I provided in the pull request is pretty self-explanatory, but do let me know if you have any questions.

Thanks! Devcards is awesome!

  • Alex

alexandergunnarson avatar Feb 08 '16 07:02 alexandergunnarson

Hey,

Could you call this data-render-fn and have it return the rendered react elements. (i.e. don't pass the result to edn-rend/html-edn). This would be much more general.

Thanks!!

bhauman avatar Feb 08 '16 16:02 bhauman

It seems that this PR can be replaced by just using projection:

:projection
(fn
  [db]
  (->> db
       (map (fn [d] {:e     (:e     d)
                     :a     (:a     d)
                     :v     (:v     d)
                     :tx    (:tx    d)
                     :added (:added d)}))))

Would we be able to either close this or to start a library of functions that work as projections? I didn't see a bunch of documentation on projection other than a simple example. Either way, I'm up for giving this a go.

ClashTheBunny avatar Sep 28 '18 16:09 ClashTheBunny

I think starting a library of projections makes a lot of sense.

bhauman avatar Sep 29 '18 17:09 bhauman