Sha256: 761241fbf9d3421a9fcec4f134d68d9824b6547e9a5e15c1ba267fe0f54e160e

Contents?: true

Size: 860 Bytes

Versions: 14

Compression:

Stored size: 860 Bytes

Contents

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

  def initialize(attributes = {})
    attributes[:type] = attributes[:type] || 'submit'
    attributes[:class] = "inline-flex items-center px-4 py-2 bg-gray-800 dark:bg-gray-200 border border-transparent rounded-md font-semibold text-xs text-white dark:text-gray-800 uppercase tracking-widest hover:bg-gray-700 dark:hover:bg-white focus:bg-gray-700 dark:focus:bg-white active:bg-gray-900 dark:active:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800 transition ease-in-out duration-150#{" #{attributes[:class]}" if attributes[:class]}"
    @attributes = attributes.map { |key, attribute| "#{key}=\"#{attribute}\"" }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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