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/main.rb

32 lines
519 B
Ruby
Raw Normal View History

2017-07-24 07:00:51 -04:00
# frozen_string_literal: true
module Widgets
class Main < Container
2017-07-25 10:29:01 -04:00
def initialize(_parent)
2017-07-24 07:00:51 -04:00
super
2017-07-25 10:29:01 -04:00
@sidebar = Widgets::Sidebar.new self
@chat = Widgets::Chat.new self
2017-07-24 18:34:50 -04:00
end
2017-07-24 07:00:51 -04:00
2017-07-25 10:48:37 -04:00
def props=(_value)
super
@sidebar.props = props[:sidebar]
@chat.props = props[:chat]
end
private
2017-07-24 18:34:50 -04:00
def focus
case props[:focus]
when :sidebar then @sidebar
when :chat then @chat
end
end
2017-07-24 07:00:51 -04:00
def children
[@sidebar, @chat]
2017-07-24 07:00:51 -04:00
end
end
end