Class: Protos::Swap

Inherits:
Component show all
Defined in:
lib/protos/swap.rb,
lib/protos/swap/on.rb,
lib/protos/swap/off.rb

Defined Under Namespace

Classes: Off, On

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Protos::Component

Instance Method Details

#offObject



27
# File 'lib/protos/swap.rb', line 27

def off(...) = render Off.new(...)

#onObject



25
# File 'lib/protos/swap.rb', line 25

def on(...) = render On.new(...)

#view_templateObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/protos/swap.rb', line 12

def view_template
  label(**attrs) do
    input(
      type: :checkbox,
      class: css[:input],
      autocomplete: :off,
      form: "",
      aria_label: "swap"
    )
    yield if block_given?
  end
end