summaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/tui_dirlist_loading.rs
blob: 2e8459613bd35ec61f7222f392392f2ecf7a5a64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
use ratatui::style::{Color, Style};
use ratatui::widgets::Widget;

pub struct TuiDirListLoading;

impl TuiDirListLoading {
    pub fn new() -> Self {
        Self {}
    }
}

impl Widget for TuiDirListLoading {
    fn render(self, area: Rect, buf: &mut Buffer) {
        if area.width < 4 || area.height < 1 {
            return;
        }
        let x = area.left();
        let y = area.top();

        let style = Style::default().fg(Color::Yellow);
        buf.set_stringn(x, y, "loading...", area.width as usize, style);
    }
}