feat: add search framework with search bar in block title
This commit is contained in:
1 parent
b4a2bca9c3
commit
6bbf95edf5
7 files changed
+122
-86
No files matched your search
@@ -11,6 +11,7 @@ pub struct PopupFrame<'a> {
|
||||
pub border_color: Color,
|
||||
pub bg: Option<Color>,
|
||||
pub keybinds: Option<Line<'a>>,
|
||||
pub search_line: Option<Line<'a>>,
|
||||
pub content: Box<dyn Fn(Rect, &mut Buffer) + 'a>,
|
||||
}
|
||||
|
||||
@@ -28,6 +29,10 @@ impl<'a> Widget for PopupFrame<'a> {
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(Style::default().fg(self.border_color));
|
||||
|
||||
if let Some(sl) = self.search_line {
|
||||
block = block.title_top(sl.alignment(Alignment::Right));
|
||||
}
|
||||
|
||||
if let Some(kb) = self.keybinds {
|
||||
block = block.title_bottom(kb.alignment(Alignment::Right));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user