Sha256: ba4effcdd1b8cdf3ea8a1c04f1a2b43965273f87a8709973e3d2fa17337a904e

Contents?: true

Size: 1.25 KB

Versions: 15

Compression:

Stored size: 1.25 KB

Contents

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

  def initialize(attributes = {})
    classes = attributes[:active] \
      ? 'block w-full ps-3 pe-4 py-2 border-l-4 border-indigo-400 dark:border-indigo-600 text-start text-base font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-900/50 focus:outline-none focus:text-indigo-800 dark:focus:text-indigo-200 focus:bg-indigo-100 dark:focus:bg-indigo-900 focus:border-indigo-700 dark:focus:border-indigo-300 transition duration-150 ease-in-out' \
      : 'block w-full ps-3 pe-4 py-2 border-l-4 border-transparent text-start text-base font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600 focus:outline-none focus:text-gray-800 dark:focus:text-gray-200 focus:bg-gray-50 dark:focus:bg-gray-700 focus:border-gray-300 dark:focus:border-gray-600 transition duration-150 ease-in-out'
    attributes[:class] = "#{classes}#{" #{attributes[:class]}" if attributes[:class]}"
    @attributes = attributes.without(:active).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/responsive_nav_link_component.rb
kaze-0.16.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.15.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.14.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.13.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.12.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.11.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.10.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.9.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.8.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.7.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.6.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.5.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.4.0 stubs/hotwire/app/components/responsive_nav_link_component.rb
kaze-0.3.0 stubs/hotwire/app/components/responsive_nav_link_component.rb