Class: ScrimComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- ScrimComponent
- Defined in:
- app/components/scrim_component.rb
Constant Summary collapse
- ACTIONS =
%w[ click->scrim#dismiss keyup@window->scrim#escape ].freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#z_index ⇒ Object
readonly
Returns the value of attribute z_index.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(id: "scrim", z_index: 40) ⇒ ScrimComponent
constructor
A new instance of ScrimComponent.
- #inspect ⇒ Object
Constructor Details
#initialize(id: "scrim", z_index: 40) ⇒ ScrimComponent
Returns a new instance of ScrimComponent.
11 12 13 14 15 16 |
# File 'app/components/scrim_component.rb', line 11 def initialize(id: "scrim", z_index: 40) super @id = id @z_index = z_index end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'app/components/scrim_component.rb', line 4 def id @id end |
#z_index ⇒ Object (readonly)
Returns the value of attribute z_index.
4 5 6 |
# File 'app/components/scrim_component.rb', line 4 def z_index @z_index end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/scrim_component.rb', line 18 def call tag.div(id:, class: "scrim", data: { controller: "scrim", scrim_z_index_value: z_index, turbo_permanent: "", action: ACTIONS.join(" "), }) end |
#inspect ⇒ Object
29 30 31 |
# File 'app/components/scrim_component.rb', line 29 def inspect "#<#{self.class.name} id: #{id.inspect}>" end |