Sha256: 6ea34b311b165efb9cb9cc9b755eed3b4ce3f20ae7655fea35ee7e5b9161faab
Contents?: true
Size: 858 Bytes
Versions: 11
Compression:
Stored size: 858 Bytes
Contents
# frozen_string_literal: true module PandaCms module Admin class TagComponent < ViewComponent::Base attr_accessor :status, :text def initialize(status: :active, text: nil) @status = status.to_sym @text = text || status.to_s.humanize end def call classes = "inline-flex items-center py-1 px-2 text-xs font-medium rounded-md ring-1 ring-inset" classes += case @status when :active "text-green-700 bg-green-50 ring-green-600/20 " when :draft "text-yellow-700 bg-yellow-50 ring-yellow-600/20 " when :inactive, :hidden "text-red-700 bg-red-50 ring-red-600/20 " else "text-gray-700 bg-gray-50 ring-gray-600/20 " end content_tag :span, class: classes do @text end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems