Sha256: 45cea07fd69b412e7c35c72ae9f52a55ebf219351799933fe7f513337155579c

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

module RailsLiveDashboard
  class RequestMethodBadgeComponent < ViewComponent::Base
    CLASSES = {
      get: 'fill-green-500',
      post: 'fill-yellow-500',
      put: 'fill-blue-500',
      patch: 'fill-indigo-500',
      delete: 'fill-red-500',
      head: 'fill-green-500',
      option: 'fill-purple-500'
    }.freeze

    def initialize(method, turbo_stream: false)
      super

      return if method.nil?

      @classes = CLASSES[method.downcase.to_sym]
      @method = "#{method} #{'- Turbo Stream' if turbo_stream}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_live_dashboard-0.2.0 app/components/rails_live_dashboard/request_method_badge_component.rb
rails_live_dashboard-0.1.2 app/components/rails_live_dashboard/request_method_badge_component.rb
rails_live_dashboard-0.1.1 app/components/rails_live_dashboard/request_method_badge_component.rb
rails_live_dashboard-0.1.0 app/components/rails_live_dashboard/request_method_badge_component.rb