Sha256: c768a0a715264c92ace85dda284fdf2a8a882202d230c9e955e9026e83bd84b2
Contents?: true
Size: 644 Bytes
Versions: 4
Compression:
Stored size: 644 Bytes
Contents
# frozen_string_literal: true module RailsLiveDashboard class RequestStatusBadgeComponent < ViewComponent::Base CLASSES = { 100..199 => 'bg-blue-50 text-blue-700 ring-blue-700/10', 200..299 => 'bg-green-50 text-green-700 ring-green-600/20', 300..399 => 'bg-yellow-50 text-yellow-800 ring-yellow-600/20', 400..499 => 'bg-orange-50 text-orange-700 ring-orange-600/10', 500..599 => 'bg-red-50 text-red-700 ring-red-600/10' }.freeze def initialize(status) super return if status.nil? @status = status @classes = CLASSES.detect { |k, _v| k === status }&.last end end end
Version data entries
4 entries across 4 versions & 1 rubygems