Sha256: 0990f411c106cf2662fc9314d15019c0f1b79c0ddf3497d858161af50b33c3ad

Contents?: true

Size: 638 Bytes

Versions: 59

Compression:

Stored size: 638 Bytes

Contents

<%
  backgrounds = {
    info: 'bg-blue-500',
    success: 'bg-green-500',
    danger: 'bg-red-500',
    warning: 'bg-yellow-500',
  }

  label = @value
  background = :info

  @options.invert.each do |values, type|
    if [values].flatten.map { |value| value.to_s }.include? @value
      label = @value
      background = type.to_sym
      next
    end
  end

  classes = 'whitespace-nowrap rounded-md uppercase px-2 py-1 text-xs font-bold block text-center truncate '

  classes += "#{backgrounds[background]} text-white" if backgrounds[background].present?
%>
<span class="<%= classes %>" style="max-width: 120px;"><%= label %></span>

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
avo-1.7.0 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.4.pre.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.3.pre.3 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.3.pre.2 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.3.pre.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.2.pre.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.6.0 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.5.5 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.5.4 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.5.3 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.5.2 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.5.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.5.0 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.4.5.pre.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.4.4.pre.1 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.4.4 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.4.3 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.4.2 app/components/avo/fields/common/badge_viewer_component.html.erb
avo-1.4.1 app/components/avo/fields/common/badge_viewer_component.html.erb