Module: Rooibos::Welcome::UI
- Defined in:
- lib/rooibos/welcome.rb
Overview
Defined Under Namespace
Modules: Styles, Widgets
Classes: ButtonAreas
Constant Summary
collapse
- BUTTON_SLOTS =
{ website: 1, exit: 3 }.freeze
- FOCUS_ORDER =
[:website, :exit].freeze
- BUTTON_BAR_CONSTRAINTS =
[
RatatuiRuby::Layout::Constraint.fill(1),
RatatuiRuby::Layout::Constraint.length(18),
RatatuiRuby::Layout::Constraint.length(2),
RatatuiRuby::Layout::Constraint.length(14),
RatatuiRuby::Layout::Constraint.fill(1),
].freeze
- CONTENT_CONSTRAINTS =
[
RatatuiRuby::Layout::Constraint.fill(1),
RatatuiRuby::Layout::Constraint.length(1),
].freeze
Class Method Summary
collapse
Class Method Details
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/rooibos/welcome.rb', line 114
def self.button_bar(focused:, hovered:)
RatatuiRuby::Layout::Layout.new(
direction: :horizontal,
constraints: BUTTON_BAR_CONSTRAINTS,
children: [
nil,
Widgets.website_button(focused: focused == :website, hovered: hovered == :website),
nil,
Widgets.exit_button(focused: focused == :exit, hovered: hovered == :exit),
nil,
]
)
end
|
.content_layout(focused:, hovered:) ⇒ Object
128
129
130
131
132
133
134
|
# File 'lib/rooibos/welcome.rb', line 128
def self.content_layout(focused:, hovered:)
RatatuiRuby::Layout::Layout.new(
direction: :vertical,
constraints: CONTENT_CONSTRAINTS,
children: [Widgets::PARAGRAPH, button_bar(focused:, hovered:)]
)
end
|
.frame(focused:, hovered:) ⇒ Object
136
137
138
139
140
141
142
143
144
|
# File 'lib/rooibos/welcome.rb', line 136
def self.frame(focused:, hovered:)
RatatuiRuby::Widgets::Block.new(
title: "Hello, Rooibos!",
borders: [:all],
border_style: { fg: :cyan },
padding: [2, 2, 1, 1],
children: [content_layout(focused:, hovered:)]
)
end
|