$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "ratatui_ruby"
class VerifyQuickstartLayout
def run
RatatuiRuby.run do |tui|
loop do
tui.draw do |frame|
top, bottom = tui.layout_split(
frame.area,
direction: :vertical,
constraints: [
tui.constraint_percentage(75),
tui.constraint_percentage(25),
]
)
frame.render_widget(
tui.paragraph(
text: "Hello, Ratatui!",
alignment: :center,
block: tui.block(title: "Content", borders: [:all], border_style: { fg: "cyan" })
),
top
)
text_line = tui.text_line(
spans: [
tui.text_span(content: "Press '"),
tui.text_span(
content: "q",
style: tui.style(modifiers: [:bold, :underlined])
),
tui.text_span(content: "' to quit."),
],
alignment: :center
)
frame.render_widget(
tui.paragraph(
text: text_line,
block: tui.block(title: "Controls", borders: [:all])
),
bottom
)
end
case tui.poll_event
in { type: :key, code: "q" }
break
else
end
end
end
end
end
VerifyQuickstartLayout.new.run if __FILE__ == $PROGRAM_NAME