Archived
1
0
Fork 0

Add method Curses::React::Component#create_element

This commit is contained in:
Braiden Vasco 2017-07-28 11:37:02 +00:00
parent 3a8bbdbe3a
commit bf2b6fc01a
2 changed files with 7 additions and 3 deletions

View file

@ -50,6 +50,10 @@ module Curses
def addstr(s) def addstr(s)
window.addstr s window.addstr s
end end
def create_element(type, props = {}, &block)
Element.create type, props, &block
end
end end
end end
end end

View file

@ -44,8 +44,8 @@ module Widgets
def render_public_key def render_public_key
Curses::React::Nodes.create( Curses::React::Nodes.create(
Curses::React::Element.create(:line) do create_element(:line) do
Curses::React::Element.create( create_element(
:text_line, :text_line,
x: 0, x: 0,
y: 1, y: 1,
@ -53,7 +53,7 @@ module Widgets
text: PUBLIC_KEY_LABEL, text: PUBLIC_KEY_LABEL,
) )
Curses::React::Element.create( create_element(
:text_line, :text_line,
x: PUBLIC_KEY_LABEL.length, x: PUBLIC_KEY_LABEL.length,
y: 1, y: 1,