Add Border widget
This commit is contained in:
parent
6a0c0474ec
commit
964f3bf011
3 changed files with 208 additions and 3 deletions
|
|
@ -2,18 +2,20 @@ use std::convert::Infallible;
|
|||
|
||||
use crossterm::event::Event;
|
||||
use crossterm::style::{ContentStyle, Stylize};
|
||||
use toss::widgets::Text;
|
||||
use toss::widgets::{Border, BorderLook, Text};
|
||||
use toss::{Styled, Terminal, Widget};
|
||||
|
||||
fn widget() -> impl Widget<Infallible> {
|
||||
Text::new(
|
||||
Border::new(Text::new(
|
||||
Styled::new("Hello world!", ContentStyle::default().green())
|
||||
.then_plain("\n")
|
||||
.then(
|
||||
"Press any key to exit",
|
||||
ContentStyle::default().on_dark_blue(),
|
||||
),
|
||||
)
|
||||
))
|
||||
.look(BorderLook::LINE_DOUBLE)
|
||||
.style(ContentStyle::default().dark_red())
|
||||
}
|
||||
|
||||
fn render_frame(term: &mut Terminal) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue