Class: Avo::Fields::Common::BooleanCheckComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/fields/common/boolean_check_component.rb

Constant Summary collapse

STATE_CONFIG =
{
  true => {
    name: "checked",
    icon: "heroicons/outline/check-circle",
    color: "text-green-600"
  },
  false => {
    name: "unchecked",
    icon: "heroicons/outline/x-circle",
    color: "text-red-600"
  },
  nil => {
    name: "indeterminate",
    icon: "heroicons/outline/minus-circle",
    color: "text-gray-400"
  }
}.freeze

Instance Method Summary collapse

Instance Method Details

#classesObject



32
33
34
35
36
37
# File 'app/components/avo/fields/common/boolean_check_component.rb', line 32

def classes
  helpers.class_names(STATE_CONFIG[@checked][:color], {
    "h-5": @size == :sm,
    "h-6": @size == :md,
  })
end

#stateObject



28
29
30
# File 'app/components/avo/fields/common/boolean_check_component.rb', line 28

def state
  STATE_CONFIG[@checked][:name]
end