Class: ShadcnPhlexcomponents::BreadcrumbLink

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/breadcrumb.rb

Constant Summary

Constants inherited from Base

ShadcnPhlexcomponents::Base::SANITIZER_ALLOWED_ATTRIBUTES, ShadcnPhlexcomponents::Base::SANITIZER_ALLOWED_TAGS, ShadcnPhlexcomponents::Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #default_attributes, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(name = nil, options = nil, html_options = nil) ⇒ BreadcrumbLink

Returns a new instance of BreadcrumbLink.



86
87
88
89
90
# File 'lib/shadcn_phlexcomponents/components/breadcrumb.rb', line 86

def initialize(name = nil, options = nil, html_options = nil)
  @name = name
  @options = options
  @html_options = html_options
end

Instance Method Details

#view_template ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/shadcn_phlexcomponents/components/breadcrumb.rb', line 92

def view_template(&)
  if block_given?
    @html_options = @options
    @options = @name
  end

  @html_options ||= {}
  @html_options[:class] = class_variants(class: @html_options[:class])

  if block_given?
    link_to(@options, @html_options, &)
  else
    link_to(@name, @options, @html_options)
  end
end