improv: use sort-icons instead of unicode arrow glyphs
This commit is contained in:
parent
1d88fd16d6
commit
af65a6b1c0
1 changed files with 18 additions and 11 deletions
29
src/menu.rs
29
src/menu.rs
|
|
@ -107,18 +107,25 @@ pub fn context_menu<'a>(
|
||||||
|
|
||||||
let (sort_name, sort_direction, _) = tab.sort_options();
|
let (sort_name, sort_direction, _) = tab.sort_options();
|
||||||
let sort_item = |label, variant| {
|
let sort_item = |label, variant| {
|
||||||
menu_item(
|
let key = find_key(&Action::ToggleSort(variant));
|
||||||
format!(
|
let leading: Element<'a, tab::Message> = if sort_name == variant {
|
||||||
"{} {}",
|
let icon_name = if sort_direction {
|
||||||
label,
|
"view-sort-ascending-symbolic"
|
||||||
match (sort_name == variant, sort_direction) {
|
} else {
|
||||||
(true, true) => "\u{2B07}",
|
"view-sort-descending-symbolic"
|
||||||
(true, false) => "\u{2B06}",
|
};
|
||||||
_ => "",
|
widget::icon::from_name(icon_name).size(14).into()
|
||||||
}
|
} else {
|
||||||
),
|
space::horizontal().width(Length::Fixed(14.0)).into()
|
||||||
Action::ToggleSort(variant),
|
};
|
||||||
|
menu_button!(
|
||||||
|
leading,
|
||||||
|
space::horizontal().width(Length::Fixed(theme::spacing().space_xxs.into())),
|
||||||
|
text::body(label),
|
||||||
|
space::horizontal(),
|
||||||
|
text::body(key).class(theme::Text::Custom(key_style))
|
||||||
)
|
)
|
||||||
|
.on_press(tab::Message::ContextAction(Action::ToggleSort(variant)))
|
||||||
.into()
|
.into()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue