mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
working main menu
This commit is contained in:
parent
559d2fc4a1
commit
f81f16b47b
7 changed files with 130 additions and 80 deletions
|
|
@ -86,18 +86,25 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
|||
":dialog/menu" => Box::new(if let Dialog::Menu(selected, items) = &app.dialog {
|
||||
let items = items.clone();
|
||||
let selected = *selected;
|
||||
Some(Fill::xy(Align::c(Tui::bg(Red, Fill::x(Stack::south(move|add|{
|
||||
for (index, item) in items.iter().enumerate() {
|
||||
Some(Fill::x(Stack::south(move|add|{
|
||||
for (index, MenuItem(item, _)) in items.0.iter().enumerate() {
|
||||
add(&Tui::fg_bg(
|
||||
if selected == index { Rgb(240,200,180) } else { Rgb(200, 200, 200) },
|
||||
if selected == index { Rgb(80, 80, 50) } else { Rgb(30, 30, 30) },
|
||||
Fixed::y(2, Align::n(Fill::x(item)))
|
||||
));
|
||||
}
|
||||
}))))))
|
||||
})))
|
||||
} else {
|
||||
None
|
||||
}),
|
||||
":logo" => Box::new(Fixed::xy(32, 7, Tui::bold(true, Tui::fg(Rgb(240,200,180), Stack::south(|add|{
|
||||
add(&Fixed::y(1, ""));
|
||||
add(&Fixed::y(1, ""));
|
||||
add(&Fixed::y(1, "~~ ╓─╥─╖ ╓──╖ ╥ ╖ ~~~~~~~~~~~~"));
|
||||
add(&Fixed::y(1, Bsp::e("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", Bsp::e(Tui::fg(Rgb(230,100,40), "v0.3.0"), " ~~"))));
|
||||
add(&Fixed::y(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"));
|
||||
}))))),
|
||||
":templates" => Box::new({
|
||||
let modes = app.config.modes.clone();
|
||||
let height = (modes.read().unwrap().len() * 2) as u16;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue