19 lines
614 B
Ruby
19 lines
614 B
Ruby
module ApplicationHelper
|
|
|
|
def colored_pill_tag(content_or_options_with_block = nil, options = nil, &block)
|
|
if block_given?
|
|
options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
|
|
end
|
|
|
|
color = options.fetch(:color).presence || "gray"
|
|
classes = "px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-#{color}-100 text-#{color}-800"
|
|
|
|
if block_given?
|
|
content_tag(:span, class: classes, &block)
|
|
else
|
|
content_tag(:span, content_or_options_with_block, class: classes)
|
|
end
|
|
|
|
end
|
|
end
|