Archived
1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
cli-old/lib/widgets/sidebar.rb
2017-07-25 16:22:38 +00:00

40 lines
605 B
Ruby

# frozen_string_literal: true
module Widgets
class Sidebar < Container
def initialize(_parent)
super
@logo = Logo.new self
@menu = Menu.new self
end
def props=(_value)
super
@logo.props = props[:logo]
@menu.props = props[:menu].merge(
on_up: props[:on_menu_up],
on_down: props[:on_menu_down],
).freeze
end
def trigger(event)
focus&.trigger event
end
private
def focus
case props[:focus]
when :menu
@menu
end
end
def children
[@logo, @menu]
end
end
end