Sha256: 3a5f676d586396f09d95ba3d1b363fa455d2a57953d844345bb4b9efcbff558f

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

class Alveole::ChipComponent < ViewComponent::Base
  def initialize(label:, color: :default, size: :sm)
    @label = label
    @color = color
    @class_color = CLASS_COLOR[color.to_sym]
    @class_size = CLASS_SIZE[size.to_sym]
  end

  CLASS_COLOR = {
    default: "bg-gray-50 ring-gray-500/10 text-gray-600",
    error: "bg-red-50 text-red-700 ring-red-600/10",
    warning: "bg-yellow-50 text-yellow-800 ring-yellow-600/20",
    success: "bg-green-50 text-green-700 ring-green-600/20",
    info: "bg-blue-50 text-blue-700 ring-blue-700/10",
    primary: "bg-primary-50 text-primary-700 ring-primary-700/10",
  }
  CLASS_SIZE = {
    sm: "text-sm gap-x-2",
    xs: "text-xs"
  }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alveole-1.0.0.pre.alpha.1 app/components/alveole/chip_component.rb