breadcrumbs_on_rails
breadcrumbs_on_rails copied to clipboard
Breadcrumbs outside controllers (like storybook previews)
Since the breadcrumbs gem is tightly coupled with controllers, I wonder if there is a way to use it outside a controller by explicitly including it in a class. This would be especially useful for previews.
We use the view_component gem and I haven't found a way to use this gem inside the ViewComponent::Preview
.
Something like this would be useful:
class BreadcrumbsComponentPreview < ViewComponent::Preview
include BreadcrumbsOnRails # Include gem in another class
add_breadcrumb :home, "/"
def default
render BreadcrumbsComponent.new
end
end
I recommend the lookbook gem for view component previews.