mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: combine button label config into an array
This commit is contained in:
parent
cb27f5c74a
commit
d2fe67ab86
3 changed files with 14 additions and 16 deletions
|
|
@ -101,8 +101,7 @@ selected = { reversed = true }
|
||||||
# : Confirm {{{
|
# : Confirm {{{
|
||||||
|
|
||||||
[confirm]
|
[confirm]
|
||||||
button_yes = " [Y]es "
|
button_labels = [" [Y]es ", " (N)o "]
|
||||||
button_no = " (N)o "
|
|
||||||
border = { fg = "blue" }
|
border = { fg = "blue" }
|
||||||
title = { fg = "blue" }
|
title = { fg = "blue" }
|
||||||
content = { }
|
content = { }
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,7 @@ pub struct Input {
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Confirm {
|
pub struct Confirm {
|
||||||
pub button_yes: String,
|
pub button_labels: [String; 2],
|
||||||
pub button_no: String,
|
|
||||||
pub border: Style,
|
pub border: Style,
|
||||||
pub title: Style,
|
pub title: Style,
|
||||||
pub content: Style,
|
pub content: Style,
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ impl Widget for Buttons {
|
||||||
let chunks =
|
let chunks =
|
||||||
ratatui::layout::Layout::horizontal([Constraint::Fill(1), Constraint::Fill(1)]).split(area);
|
ratatui::layout::Layout::horizontal([Constraint::Fill(1), Constraint::Fill(1)]).split(area);
|
||||||
|
|
||||||
Paragraph::new(Span::raw(&THEME.confirm.button_yes).style(THEME.confirm.buttons))
|
Paragraph::new(Span::raw(&THEME.confirm.button_labels[0]).style(THEME.confirm.buttons))
|
||||||
.centered()
|
.centered()
|
||||||
.render(chunks[0], buf);
|
.render(chunks[0], buf);
|
||||||
Paragraph::new(Span::raw(&THEME.confirm.button_no).style(THEME.confirm.buttons))
|
Paragraph::new(Span::raw(&THEME.confirm.button_labels[1]).style(THEME.confirm.buttons))
|
||||||
.centered()
|
.centered()
|
||||||
.render(chunks[1], buf);
|
.render(chunks[1], buf);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue