Create a new component to render checkboxes as switches
https://get.foundation/sites/docs/switch.html
This commit is contained in:
21
app/components/layout/cookies_consent/switch_component.rb
Normal file
21
app/components/layout/cookies_consent/switch_component.rb
Normal 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
|
||||
Reference in New Issue
Block a user