Introduce KeybindingHint (#24397)

- Implements scaling for `ui::Keybinding` and it's component parts
- Adds the `ui::KeybindingHint` component for creating keybinding hints
easily:

![CleanShot 2025-02-04 at 16 59
38@2x](https://github.com/user-attachments/assets/d781e401-8875-4edc-a4b0-5f8750777d86)

Release Notes:

- N/A
This commit is contained in:
Nate Butler 2025-02-06 16:45:03 -05:00 committed by GitHub
parent 9c132fece5
commit 00971fbe41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 390 additions and 16 deletions

View file

@ -70,6 +70,7 @@ pub enum IconSize {
Medium,
/// 48px
XLarge,
Custom(Pixels),
}
impl IconSize {
@ -80,6 +81,7 @@ impl IconSize {
IconSize::Small => rems_from_px(14.),
IconSize::Medium => rems_from_px(16.),
IconSize::XLarge => rems_from_px(48.),
IconSize::Custom(size) => rems_from_px(size.into()),
}
}
@ -96,6 +98,8 @@ impl IconSize {
IconSize::Small => DynamicSpacing::Base02.px(cx),
IconSize::Medium => DynamicSpacing::Base02.px(cx),
IconSize::XLarge => DynamicSpacing::Base02.px(cx),
// TODO: Wire into dynamic spacing
IconSize::Custom(size) => px(size.into()),
};
(icon_size, padding)