app/components/avo/fields/common/boolean_check_component.rb in avo-3.11.7 vs app/components/avo/fields/common/boolean_check_component.rb in avo-3.11.8
- old
+ new
@@ -1,8 +1,11 @@
# frozen_string_literal: true
class Avo::Fields::Common::BooleanCheckComponent < Avo::BaseComponent
- def initialize(checked: false)
- @icon = checked ? "heroicons/outline/check-circle" : "heroicons/outline/x-circle"
- @classes = "h-6 #{checked ? "text-green-600" : "text-red-500"}"
+ prop :checked, _Boolean, default: false
+ prop :icon, _Nilable(String) do |value|
+ @checked ? "heroicons/outline/check-circle" : "heroicons/outline/x-circle"
+ end
+ prop :classes, _Nilable(String) do |value|
+ "h-6 #{@checked ? "text-green-600" : "text-red-500"}"
end
end