endpoint_validator/tui/widgets/
input.rs1use ratatui::{
2 style::{Color, Style},
3 text::Span,
4 widgets::{Block, Borders, Paragraph},
5};
6
7pub fn create_input_widget<'a>(label: &'a str, value: &'a str, is_focused: bool) -> Paragraph<'a> {
8 let block = Block::default()
9 .borders(Borders::ALL)
10 .border_style(Style::default().fg(if is_focused {
11 Color::Yellow } else {
13 Color::Gray
14 }))
15 .title(Span::styled(
16 label,
17 Style::default().fg(if is_focused {
18 Color::Gray } else {
20 Color::Gray
21 }),
22 ));
23
24 Paragraph::new(value)
25 .style(Style::default().fg(Color::Gray))
26 .block(block)
27}