clock style (#18)

This commit is contained in:
Jens K.
2024-12-18 13:51:22 +01:00
committed by GitHub
parent 3c9ae881c9
commit ab10a38901
5 changed files with 105 additions and 56 deletions

View File

@@ -13,6 +13,8 @@ use crate::{
widgets::clock::{self, Clock, ClockWidget},
};
use super::clock::Style;
#[derive(Debug, Clone)]
pub struct Countdown {
clock: Clock<clock::Countdown>,
@@ -67,9 +69,11 @@ impl EventHandler for Countdown {
pub struct CountdownWidget;
impl StatefulWidget for CountdownWidget {
type State = Countdown;
type State = (Style, Countdown);
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
let clock = ClockWidget::new();
let style = state.0;
let state = &mut state.1;
let clock = ClockWidget::new(style);
let label = Line::raw((format!("Countdown {}", state.clock.get_mode())).to_uppercase());
let area = center(