|
@@ -5,9 +5,9 @@ use termion::{async_stdin, event::Key, input::TermRead, raw::IntoRawMode};
|
|
|
use tui::{
|
|
use tui::{
|
|
|
backend::TermionBackend,
|
|
backend::TermionBackend,
|
|
|
layout::{Constraint, Direction, Layout},
|
|
layout::{Constraint, Direction, Layout},
|
|
|
- style::{Color, Style},
|
|
|
|
|
|
|
+ style::{Color, Modifier, Style},
|
|
|
text::Spans,
|
|
text::Spans,
|
|
|
- widgets::{Block, Borders, Paragraph},
|
|
|
|
|
|
|
+ widgets::{Block, Borders, List, ListItem, Paragraph, Widget},
|
|
|
Terminal,
|
|
Terminal,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -38,8 +38,24 @@ fn main() -> Result<()> {
|
|
|
// With white foreground and black background...
|
|
// With white foreground and black background...
|
|
|
.style(Style::default().fg(Color::White).bg(Color::Black));
|
|
.style(Style::default().fg(Color::White).bg(Color::Black));
|
|
|
|
|
|
|
|
- // Render into the second chunk of the layout.
|
|
|
|
|
|
|
+ // Render into the layout.
|
|
|
frame.render_widget(graph, size);
|
|
frame.render_widget(graph, size);
|
|
|
|
|
+
|
|
|
|
|
+ // create a list
|
|
|
|
|
+ let mut items: Vec<ListItem> = Vec::new();
|
|
|
|
|
+ for num in 1..11 {
|
|
|
|
|
+ let new_item = ListItem::new(format!("Node {}", num));
|
|
|
|
|
+ items.push(new_item);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let list = List::new(items)
|
|
|
|
|
+ .block(Block::default().title("Nodes").borders(Borders::ALL))
|
|
|
|
|
+ .style(Style::default().fg(Color::White))
|
|
|
|
|
+ .highlight_style(Style::default().add_modifier(Modifier::ITALIC))
|
|
|
|
|
+ .highlight_symbol(">>");
|
|
|
|
|
+
|
|
|
|
|
+ // draw a list
|
|
|
|
|
+ frame.render_widget(list, size);
|
|
|
})?;
|
|
})?;
|
|
|
|
|
|
|
|
// Iterate over all the keys that have been pressed since the
|
|
// Iterate over all the keys that have been pressed since the
|