class Sirens::Stack

Component that wraps a StackView.

Public Class Methods

horizontal(props = Hash[]) click to toggle source
# File lib/components/containers/stack.rb, line 10
def horizontal(props = Hash[])
    props[:orientation] = :horizontal

    self.new(props)
end
vertical(props = Hash[]) click to toggle source
# File lib/components/containers/stack.rb, line 16
def vertical(props = Hash[])
    props[:orientation] = :vertical

    self.new(props)
end

Public Instance Methods

create_view() click to toggle source

Returns a StackView.

# File lib/components/containers/stack.rb, line 26
def create_view()
    StackView.new(props.fetch(:orientation))
end
on_component_added(child_component) click to toggle source

Adds the child_component to this component.

# 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