diff --git a/lib/curses/react/component.rb b/lib/curses/react/component.rb index fd792f9..79632d6 100644 --- a/lib/curses/react/component.rb +++ b/lib/curses/react/component.rb @@ -50,6 +50,10 @@ module Curses def addstr(s) window.addstr s end + + def create_element(type, props = {}, &block) + Element.create type, props, &block + end end end end diff --git a/lib/widgets/chat/info.rb b/lib/widgets/chat/info.rb index 864af4d..5509e5b 100644 --- a/lib/widgets/chat/info.rb +++ b/lib/widgets/chat/info.rb @@ -44,8 +44,8 @@ module Widgets def render_public_key Curses::React::Nodes.create( - Curses::React::Element.create(:line) do - Curses::React::Element.create( + create_element(:line) do + create_element( :text_line, x: 0, y: 1, @@ -53,7 +53,7 @@ module Widgets text: PUBLIC_KEY_LABEL, ) - Curses::React::Element.create( + create_element( :text_line, x: PUBLIC_KEY_LABEL.length, y: 1,