One more clean up fix

This commit is contained in:
Wojciech Kozlowski 2023-04-12 10:25:24 +02:00
parent 9e7d2edc0d
commit 47aa6d2e96

View File

@ -242,11 +242,12 @@ impl Ui {
}) })
} }
fn block<'a>() -> Block<'a> { fn block<'a>(title: &str) -> Block<'a> {
Block::default() Block::default()
.title_alignment(Alignment::Center) .title_alignment(Alignment::Center)
.borders(Borders::ALL) .borders(Borders::ALL)
.border_type(BorderType::Rounded) .border_type(BorderType::Rounded)
.title(format!(" {title} "))
} }
fn render_list_widget<B: Backend>( fn render_list_widget<B: Backend>(
@ -260,7 +261,7 @@ impl Ui {
.highlight_style(Self::highlight_style(list.active)) .highlight_style(Self::highlight_style(list.active))
.highlight_symbol(">> ") .highlight_symbol(">> ")
.style(Self::style()) .style(Self::style())
.block(Self::block().title(format!(" {title} "))), .block(Self::block(title)),
area, area,
&mut list.state, &mut list.state,
); );
@ -273,9 +274,7 @@ impl Ui {
frame: &mut Frame<'_, B>, frame: &mut Frame<'_, B>,
) { ) {
frame.render_widget( frame.render_widget(
paragraph paragraph.style(Self::style()).block(Self::block(title)),
.style(Self::style())
.block(Self::block().title(format!(" {title} "))),
area, area,
); );
} }