use ratatui::prelude::{Color, Style};
use ratatui::widgets::{Block, BorderType};
pub trait RoundedBlockExt<'a> {
fn rounded() -> Block<'a>;
fn roundedt(title: &'a str) -> Block<'a>;
fn invisible() -> Block<'a>;
fn highlight_if(self, active: bool) -> Self;
}
impl<'a> RoundedBlockExt<'a> for Block<'a> {
fn rounded() -> Block<'a> {
Block::bordered().border_type(BorderType::Rounded)
}
fn roundedt(title: &'a str) -> Block<'a> {
Block::rounded().title(title)
}
fn invisible() -> Block<'a> {
Block::bordered().border_style(Style::new().fg(Color::Black))
}
fn highlight_if(self, condition: bool) -> Self {
if condition {
self.border_style(Style::default().fg(Color::Yellow))
} else {
self
}
}
}