Sha256: 62df4ecc2e7c1522e612a719404beb6a27e341f1230d91b4e60c245ffdbf84d3

Contents?: true

Size: 1.15 KB

Versions: 66

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Ariadne
  # Breadcrumb component showing current navigation. The last item is considered the active one
  class BreadcrumbsComponent < Ariadne::Component
    DEFAULT_TAG = :nav
    TAG_OPTIONS = [DEFAULT_TAG].freeze

    DEFAULT_CLASSES = { wrapper: "", item: "", active_item: "ariadne-underline" }

    # @example Default
    #
    #   <%= render(Ariadne::BreadcrumbsComponent.new) { "Example" } %>
    #
    # @param tag [Symbol, String] The rendered tag name.
    # @param classes [String] <%= link_to_classes_docs %>
    # @param attributes [Hash] <%= link_to_attributes_docs %>
    def initialize(tag: DEFAULT_TAG, classes: "", items: [], item_classes: "", active_item_classes: "", attributes: {})
      @tag = check_incoming_tag(DEFAULT_TAG, tag)
      @classes = merge_class_names(
        DEFAULT_CLASSES[:wrapper],
        classes,
      )

      @items = items
      @item_classes = merge_class_names(DEFAULT_CLASSES[:item], item_classes)
      @active_item_classes = merge_class_names(DEFAULT_CLASSES[:item], DEFAULT_CLASSES[:active_item], item_classes, active_item_classes)
      @attributes = attributes
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.59-x64-mingw-ucrt app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.59-aarch64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.59-x86_64-darwin app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.59-x86_64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.59-arm64-darwin app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.59 app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.58-x86_64-darwin app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.58-aarch64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.58-arm64-darwin app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.58-x64-mingw-ucrt app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.58 app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.58-x86_64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.57-arm64-darwin app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.57-aarch64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.57-x86_64-darwin app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.57-x86_64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.57-x64-mingw-ucrt app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.57 app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.55-x86_64-linux app/components/ariadne/breadcrumbs_component.rb
ariadne_view_components-0.0.55-arm64-darwin app/components/ariadne/breadcrumbs_component.rb