Class: Protos::Collapse
- Inherits:
-
Component
- Object
- Phlex::HTML
- Component
- Protos::Collapse
show all
- Defined in:
- lib/protos/collapse.rb,
lib/protos/collapse/title.rb,
lib/protos/collapse/content.rb
Defined Under Namespace
Classes: Content, Title
Constant Summary
collapse
- Icons =
Types::Coercible::Symbol.enum(:arrow, :plus)
- ICONS =
{
arrow: "collapse-arrow",
plus: "collapse-plus"
}.freeze
- States =
Types::Coercible::Symbol.enum(:default, :open, :close)
- STATES =
{
default: "",
open: "collapse-open",
close: "collapse-close"
}.freeze
Instance Method Summary
collapse
Methods inherited from Component
#initialize
Instance Method Details
#content ⇒ Object
55
|
# File 'lib/protos/collapse.rb', line 55
def content(...) = render Content.new(...)
|
#title ⇒ Object
53
|
# File 'lib/protos/collapse.rb', line 53
def title(*, **, &) = render Title.new(*, input_id: @input_name, **, &)
|
#view_template ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/protos/collapse.rb', line 35
def view_template
div(**attrs) do
if @input_type
input(
type: @input_type,
id: @input_name,
name: @input_name,
autocomplete: :off,
aria_label: "Toggle accordion",
form: ""
)
end
yield if block_given?
end
end
|