akkounts/app/components/form_elements/fieldset_toggle_component.rb

18 lines
497 B
Ruby

# frozen_string_literal: true
module FormElements
class FieldsetToggleComponent < ViewComponent::Base
def initialize(form: nil, attribute: nil, tag: "li", enabled: false,
input_enabled: true, title:, description:)
@form = form
@attribute = attribute
@tag = tag
@enabled = enabled
@input_enabled = input_enabled
@title = title
@descripton = description
@button_text = @enabled ? "Switch off" : "Switch on"
end
end
end