Sha256: bc9db73b9004b2f737aabd27621549a70f5074a8f7066f841a8ac536cce08851

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kaze-0.4.0 stubs/hotwire/app/components/secondary_button_component.rb
kaze-0.3.0 stubs/hotwire/app/components/secondary_button_component.rb