Skip to content

Breadcrumbs outside controllers (like storybook previews) #139

Open
@0x7466

Description

@0x7466

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions