Allow disabling toggles, add toggle fieldset component

This commit is contained in:
Râu Cao
2023-03-12 13:41:36 +07:00
committed by Gitea
parent 805733939c
commit e758e258a8
5 changed files with 41 additions and 20 deletions
@@ -0,0 +1,14 @@
# frozen_string_literal: true
module FormElements
class FieldsetToggleComponent < ViewComponent::Base
def initialize(tag: "li", enabled: false, input_enabled: true, title:, description:)
@tag = tag
@enabled = enabled
@input_enabled = input_enabled
@title = title
@descripton = description
@button_text = @enabled ? "Switch off" : "Switch on"
end
end
end