Restore keybinding changes

This commit is contained in:
Nate Butler 2024-01-03 16:55:56 -05:00
parent f39bc6e132
commit 46e44f9853

View file

@ -21,9 +21,9 @@ impl RenderOnce for KeyBinding {
h_stack() h_stack()
.flex_none() .flex_none()
.gap_0p5() .gap_0p5()
.bg(cx.theme().colors().element_background)
.p_0p5() .p_0p5()
.rounded_sm() .rounded_sm()
.text_color(cx.theme().colors().text_muted)
.when(keystroke.modifiers.function, |el| el.child(Key::new("fn"))) .when(keystroke.modifiers.function, |el| el.child(Key::new("fn")))
.when(keystroke.modifiers.control, |el| { .when(keystroke.modifiers.control, |el| {
el.child(KeyIcon::new(Icon::Control)) el.child(KeyIcon::new(Icon::Control))
@ -70,6 +70,13 @@ impl KeyBinding {
"down" => Some(Icon::ArrowDown), "down" => Some(Icon::ArrowDown),
"backspace" => Some(Icon::Backspace), "backspace" => Some(Icon::Backspace),
"delete" => Some(Icon::Delete), "delete" => Some(Icon::Delete),
"return" => Some(Icon::Return),
"enter" => Some(Icon::Return),
"tab" => Some(Icon::Tab),
"space" => Some(Icon::Space),
"escape" => Some(Icon::Escape),
"pagedown" => Some(Icon::PageDown),
"pageup" => Some(Icon::PageUp),
_ => None, _ => None,
} }
} }
@ -100,7 +107,7 @@ impl RenderOnce for Key {
.h(rems(14. / 16.)) .h(rems(14. / 16.))
.text_ui() .text_ui()
.line_height(relative(1.)) .line_height(relative(1.))
.text_color(cx.theme().colors().text) .text_color(cx.theme().colors().text_muted)
.child(self.key.clone()) .child(self.key.clone())
} }
} }
@ -118,9 +125,11 @@ pub struct KeyIcon {
impl RenderOnce for KeyIcon { impl RenderOnce for KeyIcon {
fn render(self, _cx: &mut WindowContext) -> impl IntoElement { fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
div() div().w(rems(14. / 16.)).child(
.w(rems(14. / 16.)) IconElement::new(self.icon)
.child(IconElement::new(self.icon).size(IconSize::Small)) .size(IconSize::Small)
.color(Color::Muted),
)
} }
} }