Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumbs outside controllers (like storybook previews) #139

Open
0x7466 opened this issue Apr 28, 2021 · 1 comment
Open

Breadcrumbs outside controllers (like storybook previews) #139

0x7466 opened this issue Apr 28, 2021 · 1 comment

Comments

@0x7466
Copy link

0x7466 commented Apr 28, 2021

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
@mateuszbialowas
Copy link

mateuszbialowas commented Jun 2, 2023

I recommend the lookbook gem for view component previews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants