tlc: add missing ratatui imports (Clear, Block, Borders) in pattern_dialog.rs
This commit is contained in:
@@ -11,6 +11,7 @@ use ratatui::Frame;
|
||||
|
||||
use crate::key::Key;
|
||||
use crate::terminal::color::Theme;
|
||||
use crate::terminal::popup::{centered_cols_rect, render_popup};
|
||||
use crate::widget::input::Input;
|
||||
|
||||
/// Outcome of the pattern dialog after a key press.
|
||||
@@ -93,27 +94,8 @@ impl PatternDialog {
|
||||
|
||||
/// Render the dialog centered on screen.
|
||||
pub fn render(&self, frame: &mut Frame, area: Rect, theme: &Theme) {
|
||||
let dialog_w = 50u16.min(area.width);
|
||||
let dialog_h = 7u16.min(area.height);
|
||||
let x = area.x + (area.width - dialog_w) / 2;
|
||||
let y = area.y + (area.height - dialog_h) / 2;
|
||||
let dlg_area = Rect::new(x, y, dialog_w, dialog_h);
|
||||
|
||||
frame.render_widget(Clear, dlg_area);
|
||||
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_style(Style::default().fg(theme.title_fg))
|
||||
.title(Span::styled(
|
||||
format!(" {} ", self.title),
|
||||
Style::default()
|
||||
.fg(theme.title_fg)
|
||||
.bg(theme.title_bg)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
));
|
||||
|
||||
let inner = block.inner(dlg_area);
|
||||
frame.render_widget(block, dlg_area);
|
||||
let dlg_area = centered_cols_rect(area, 50, 7);
|
||||
let inner = render_popup(frame, dlg_area, self.title.as_str(), theme);
|
||||
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
|
||||
Reference in New Issue
Block a user