add FieldV

This commit is contained in:
🪞👃🪞 2025-01-02 17:39:26 +01:00
parent 52e34ce8a7
commit c9a79b1f29
3 changed files with 34 additions and 14 deletions

View file

@ -20,3 +20,26 @@ impl<T, U> Content<Tui> for Field<T, U>
)
}
}
pub struct FieldV<T, U>(pub ItemPalette, pub T, pub U)
where T: AsRef<str> + Send + Sync, U: AsRef<str> + Send + Sync;
impl<T, U> Content<Tui> for FieldV<T, U>
where T: AsRef<str> + Send + Sync, U: AsRef<str> + Send + Sync
{
fn content (&self) -> impl Content<Tui> {
Bsp::e(
Bsp::s(
row!(
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "")),
Tui::bg(self.0.darker.rgb, Tui::fg(self.0.lighter.rgb,
Tui::bold(true, format!("{}", self.1.as_ref())))),
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "")),
),
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.lightest.rgb,
format!(" {}", self.2.as_ref())))
),
" "
)
}
}