summaryrefslogtreecommitdiffstats
path: root/src/canvas/widgets/temp_table.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/canvas/widgets/temp_table.rs')
-rw-r--r--src/canvas/widgets/temp_table.rs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/canvas/widgets/temp_table.rs b/src/canvas/widgets/temp_table.rs
index 0b5bd42f..23822b68 100644
--- a/src/canvas/widgets/temp_table.rs
+++ b/src/canvas/widgets/temp_table.rs
@@ -5,7 +5,6 @@ use tui::{
backend::Backend,
layout::{Constraint, Direction, Layout, Rect},
terminal::Frame,
- text::Span,
widgets::{Block, Borders, Row, Table},
};
@@ -79,28 +78,27 @@ impl TempTableWidget for Painter {
let title = if app_state.is_expanded {
const TITLE_BASE: &str = " Temperatures ── Esc to go back ";
- Span::styled(
- format!(
- " Temperatures ─{}─ Esc to go back ",
- "─".repeat(
- usize::from(draw_loc.width)
- .saturating_sub(TITLE_BASE.chars().count() + 2)
- )
- ),
- border_and_title_style,
+ format!(
+ " Temperatures ─{}─ Esc to go back ",
+ "─".repeat(
+ usize::from(draw_loc.width).saturating_sub(TITLE_BASE.chars().count() + 2)
+ )
)
} else if app_state.app_config_fields.use_basic_mode {
- Span::from(String::new())
+ String::new()
} else {
- Span::styled(
- " Temperatures ".to_string(),
- self.colours.widget_title_style,
- )
+ " Temperatures ".to_string()
+ };
+ let title_style = if app_state.is_expanded {
+ border_and_title_style
+ } else {
+ self.colours.widget_title_style
};
let temp_block = if draw_border {
Block::default()
- .title(title)
+ .title(&title)
+ .title_style(title_style)
.borders(Borders::ALL)
.border_style(border_and_title_style)
} else if is_on_widget {