Class: Sirens::Stack
- Inherits:
-
PrimitiveComponent
- Object
- AbstractComponent
- PrimitiveComponent
- Sirens::Stack
- Defined in:
- lib/components/containers/stack.rb
Overview
Component that wraps a StackView.
Class Method Summary collapse
Instance Method Summary collapse
-
#create_view ⇒ Object
Returns a StackView.
-
#on_component_added(child_component) ⇒ Object
Adds the child_component to this component.
Methods inherited from PrimitiveComponent
#apply_props, #initialize, #on_model_changed, #on_value_changed, #populate_popup_menu, #set_props, #subscribe_to_model_events, #sync_ui_from_model
Methods inherited from AbstractComponent
#add_all_components, #add_component, #child_components, #default_model, #initialize, #model, #on_model_changed, open, #props, #remove_component_at, #remove_last_component, #set_model, #set_props, #view
Constructor Details
This class inherits a constructor from Sirens::PrimitiveComponent
Class Method Details
.horizontal(props = Hash[]) ⇒ Object
10 11 12 13 14 |
# File 'lib/components/containers/stack.rb', line 10 def horizontal(props = Hash[]) props[:orientation] = :horizontal self.new(props) end |
.vertical(props = ) ⇒ Object
16 17 18 19 20 |
# File 'lib/components/containers/stack.rb', line 16 def vertical(props = Hash[]) props[:orientation] = :vertical self.new(props) end |
Instance Method Details
#create_view ⇒ Object
Returns a StackView.
26 27 28 |
# File 'lib/components/containers/stack.rb', line 26 def create_view() StackView.new(props.fetch(:orientation)) end |
#on_component_added(child_component) ⇒ Object
Adds the child_component to this component.
33 34 35 36 37 38 39 40 |
# File 'lib/components/containers/stack.rb', line 33 def on_component_added(child_component) view.add_view( child_component.view, expand: child_component.props.fetch(:stack_expand, true), fill: child_component.props.fetch(:stack_fill, true), padding: child_component.props.fetch(:stack_padding, 0) ) end |