Sha256: ad869041f2119ed4fa23356a8ad99e6b111cc34a2285646c478e8f317ab52f85

Contents?: true

Size: 577 Bytes

Versions: 15

Compression:

Stored size: 577 Bytes

Contents

class DropdownLinkComponent < ViewComponent::Base
  erb_template <<~ERB
    <a <%= sanitize @attributes.join(" ") %>>
      <%= content %>
    </a>
  ERB

  def initialize(attributes = {})
    attributes[:class] = "block w-full px-4 py-2 text-start text-sm leading-5 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none focus:bg-gray-100 dark:focus:bg-gray-800 transition duration-150 ease-in-out#{" #{attributes[:class]}" if attributes[:class]}"
    @attributes = attributes.map { |key, attribute| "#{key}=\"#{attribute}\"" }
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kaze-0.17.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.16.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.15.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.14.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.13.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.12.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.11.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.10.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.9.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.8.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.7.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.6.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.5.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.4.0 stubs/hotwire/app/components/dropdown_link_component.rb
kaze-0.3.0 stubs/hotwire/app/components/dropdown_link_component.rb