You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a shared component like AdminAndPublic::FooComponent.
We want both an Admin::FooComponentPreview and a Public::FooComponentPreview, because we want to see it rendered with both layouts (and thus styles).
We've realised we can't use modules for this, since Lookbook only looks for non-inherited public methods. Further, we noticed we can't even define methods like
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
We have a shared component like
AdminAndPublic::FooComponent
.We want both an
Admin::FooComponentPreview
and aPublic::FooComponentPreview
, because we want to see it rendered with both layouts (and thus styles).We've realised we can't use modules for this, since Lookbook only looks for non-inherited public methods. Further, we noticed we can't even define methods like
Lookbook simply ignores those methods, not listing them as scenarios.
I didn't dive all the way to the bottom of this, but it seems it has something to do with
YARD::CodeObjects
and the preview files being parsed.Even a
define_method
inside the preview class itself did not result in a scenario.The best we could come up with was to define methods just calling super:
Curious to hear your thoughts – how do you handle similar things? How would you suggest we handle this?
And also, I'm curious about the
CodeObjects
thing – if anyone wants to say more about how it currently works and why, that'd be super interesting.Beta Was this translation helpful? Give feedback.
All reactions