1use tui::{
2 layout::Alignment,
3 style::{Color, Modifier, Style},
4 text::{Span, Spans},
5 widgets::{Block, Borders, Paragraph},
6};
7
8pub mod main_menu_window;
9pub use main_menu_window::*;
10
11pub mod practice_window;
12pub use practice_window::*;
13
14pub mod end_window;
15pub use end_window::*;
16
17pub mod user_window;
18pub use user_window::*;
19
20pub mod statistics_window;
21pub use statistics_window::*;
22
23pub fn create_label_widget<'a>(label: &'a str, value: &'a str, color: Color) -> Paragraph<'a> {
24 Paragraph::new(vec![Spans::from(vec![
25 Span::from(label),
26 Span::styled(value, Style::default().fg(color)),
27 ])])
28 .alignment(Alignment::Center)
29}
30
31pub fn create_ui_button<'a>(activator: &'a str, rest: &'a str) -> Paragraph<'a> {
32 let button_text = vec![Spans::from(vec![
33 Span::styled(
34 activator,
35 Style::default()
36 .add_modifier(Modifier::UNDERLINED | Modifier::BOLD)
37 .fg(Color::Yellow),
38 ),
39 Span::raw(rest),
40 ])];
41
42 Paragraph::new(button_text)
43 .alignment(Alignment::Center)
44 .block(Block::default().borders(Borders::ALL))
45}