Closed Jannis closed 8 years ago
This looks good, I will look at it more tomorrow.
I think the :default-card-options
key would be the way to go. Also I think that I would rather dispatch on arity and skip the keyword options. Keyword options don't compose and they are hard to serialize if I want to pass options from a static config file into the function.
Thanks for taking the time to do this :)
Yes, start-devcard-ui!
with two different arities was what I tried first. It didn't work for some reason but I'm happy to give it another shot. So the definition would be something like:
(defmacro start-devcard-ui!
([] ...)
([options] ...))
Same for start-devcard-ui!*
probably. And you'd pass options in like this:
(start-devcard-ui! {:default-card-options {:frame false}})
rather than
(start-devcard-ui! {:frame false})
Is that what you meant?
Yeah that is what I was thinking.
Probably better to not dispatch on arity in the macro. But to just forward the args and dispatch on arity in the start-devcard-ui!*
function.
So you'd keep the (defmacro start-devcard-ui! [& [options]] ...
signature but only for the macro? Or is there a different way to not have the macro provide versions with different arities?
Sarry about not responding to this sooner. A bit busy and the current answer is I'm not sure. I'd have to experiment with it. I'm going to merge your patch and play with it :)
No problem. That's fine with me. Better to play with it and eventually settle on an approach that you are comfortable with. :)
Fall back to an empty options map. The options are stored in the app state of the system and are merged with each card's custom options in
base-card
.Note: I've tested this with and without options. I've also briefly checked the devcards examples and they seem ok. But since my knowledge of the devcards internals is limited, I don't know whether this change might have other effects that I didn't consider.
Another question is: are card options the only thing we'd ever consider to be passed to
start-devcard-ui!
or should we keep it more flexible by assumingoptions
to has a structure likerather than the one below?