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