diff options
| author | lukeflo | 2024-10-09 22:22:10 +0200 |
|---|---|---|
| committer | lukeflo | 2024-10-12 22:41:38 +0200 |
| commit | d52b16993285f6fd98d7241689e1bd950739bb88 (patch) | |
| tree | 4bbceb937aa0bae5073c88b9f24d7ed873ad004f /src/frontend/ui.rs | |
| parent | 79b2434d17ce6898672d95ac89eb2b097c31a26f (diff) | |
| download | bibiman-d52b16993285f6fd98d7241689e1bd950739bb88.tar.gz bibiman-d52b16993285f6fd98d7241689e1bd950739bb88.zip | |
simple scrollbar for entry list
Diffstat (limited to 'src/frontend/ui.rs')
| -rw-r--r-- | src/frontend/ui.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/frontend/ui.rs b/src/frontend/ui.rs index 6a292d7..32a8296 100644 --- a/src/frontend/ui.rs +++ b/src/frontend/ui.rs @@ -22,8 +22,8 @@ use ratatui::{ symbols, text::{Line, Span, Text}, widgets::{ - Block, Cell, HighlightSpacing, List, ListItem, Padding, Paragraph, Row, StatefulWidget, - Table, Widget, Wrap, + Block, Cell, HighlightSpacing, List, ListItem, Padding, Paragraph, Row, Scrollbar, + ScrollbarOrientation, StatefulWidget, Table, Widget, Wrap, }, }; @@ -82,6 +82,7 @@ impl Widget for &mut App { self.render_footer(footer_area, buf); // Render list area where entry gets selected self.render_entrytable(list_area, buf); + self.render_entry_table_scrollbar(list_area, buf); // Render infos related to selected entry // TODO: only placeholder at the moment, has to be impl. self.render_taglist(tag_area, buf); @@ -230,6 +231,20 @@ impl App { ); } + pub fn render_entry_table_scrollbar(&mut self, area: Rect, buf: &mut Buffer) { + StatefulWidget::render( + Scrollbar::default() + .orientation(ScrollbarOrientation::VerticalRight) + .track_symbol(None) + .thumb_style(Style::new().fg(Color::DarkGray)) + .begin_symbol(None) + .end_symbol(None), + area, + buf, + &mut self.entry_table.entry_scroll_state, + ); + } + pub fn render_selected_item(&mut self, area: Rect, buf: &mut Buffer) { // We get the info depending on the item's state. let style_value = Style::new().bold().fg(TEXT_FG_COLOR); |
