Module: Rooibos::Welcome::UI::Widgets

Defined in:
lib/rooibos/welcome.rb

Overview

:nodoc:

Constant Summary collapse

LIB_FILE =
SOURCE_GEM ? "lib/#{SOURCE_GEM}.rb"       : "lib/your_app.rb"
TEST_FILE =
SOURCE_GEM ? "test/test_#{SOURCE_GEM}.rb" : "test/test_your_app.rb"
WELCOME_TEXT =
{
  "Welcome to Rooibos! You will find the Ruby code " \
    "for this application in " => Styles::TEXT,
  LIB_FILE => Styles::FILENAME,
  ". The tests that verify it are at " => Styles::TEXT,
  TEST_FILE => Styles::FILENAME,
  ". You can run the tests with " => Styles::TEXT,
  "bundle exec rake test" => Styles::COMMAND,
  ". Visit " => Styles::TEXT,
  "www.rooibos.run" => Styles::URL,
  " to learn about Rooibos and to find other " \
    "Rooibos developers. You can press " => Styles::TEXT,
  "Control + C" => Styles::COMMAND,
  " to exit at any time." => Styles::TEXT,
}
PARAGRAPH =
RatatuiRuby::Widgets::Paragraph.new(
  text: RatatuiRuby::Text::Line.new(
    spans: WELCOME_TEXT.map { |text, style| RatatuiRuby::Text::Span.new(content: text, style:) }
  ),
  wrap: true,
  alignment: :left
)

Class Method Summary collapse

Class Method Details

.exit_button(focused: false, hovered: false) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/rooibos/welcome.rb', line 84

def self.exit_button(focused: false, hovered: false)
  style = if focused && hovered
    Styles::COMMAND_BUTTON_BOTH
  elsif focused
    Styles::COMMAND_BUTTON_FOCUS
  elsif hovered
    Styles::COMMAND_BUTTON_HOVER
  else
    Styles::COMMAND_BUTTON
  end
  RatatuiRuby::Text::Span.new(content: "[Exit App]", style:)
end

.website_button(focused: false, hovered: false) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/rooibos/welcome.rb', line 71

def self.website_button(focused: false, hovered: false)
  style = if focused && hovered
    Styles::URL_BUTTON_BOTH
  elsif focused
    Styles::URL_BUTTON_FOCUS
  elsif hovered
    Styles::URL_BUTTON_HOVER
  else
    Styles::URL_BUTTON
  end
  RatatuiRuby::Text::Span.new(content: "[Visit Website]", style:)
end