Create a new component to render checkboxes as switches

https://get.foundation/sites/docs/switch.html
This commit is contained in:
taitus
2024-11-29 15:39:07 +01:00
parent 0121e57fd0
commit c95c80dc32
4 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
class Layout::CookiesConsent::SwitchComponent < ApplicationComponent
attr_reader :checked, :disabled, :name, :label, :description
def initialize(name, label:, description:, checked: false, disabled: false)
@name = name
@label = label
@description = description
@checked = checked
@disabled = disabled
end
private
def checked?
checked == true
end
def disabled?
disabled == true
end
end