Sha256: 7b95c1bb6768c4d30f44687a5490934320e8d6cacda40103229b778a09d94708
Contents?: true
Size: 610 Bytes
Versions: 4
Compression:
Stored size: 610 Bytes
Contents
# frozen_string_literal: true module RailsLiveDashboard class QueryDurationBadgeComponent < ViewComponent::Base CLASSES = { ok: 'bg-green-50 text-green-700 ring-green-600/20', warning: 'bg-orange-50 text-orange-700 ring-orange-600/10', danger: 'bg-red-50 text-red-700 ring-red-600/10' }.freeze def initialize(duration) super @duration = duration @classes = duration_classes end private def duration_classes return CLASSES[:ok] if @duration < 10 return CLASSES[:warning] if @duration < 100 CLASSES[:danger] end end end
Version data entries
4 entries across 4 versions & 1 rubygems