git_ui: Update git panel commit editor, start on quick commit

- Fixes commit editor issues & updates style
- Starts on quick commit (not hooked up to anything)
- Updates some panel styles
- Adds SwitchWithLabel
- 
Release Notes:

- N/A
This commit is contained in:
Nate Butler 2025-02-10 10:52:09 -05:00 committed by GitHub
parent 69d415c8d0
commit de8d4d00ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 586 additions and 120 deletions

View file

@ -95,7 +95,7 @@ pub struct Button {
selected_icon: Option<IconName>,
selected_icon_color: Option<Color>,
key_binding: Option<KeyBinding>,
keybinding_position: KeybindingPosition,
key_binding_position: KeybindingPosition,
alpha: Option<f32>,
}
@ -121,7 +121,7 @@ impl Button {
selected_icon: None,
selected_icon_color: None,
key_binding: None,
keybinding_position: KeybindingPosition::default(),
key_binding_position: KeybindingPosition::default(),
alpha: None,
}
}
@ -197,7 +197,7 @@ impl Button {
/// This method allows you to specify where the keybinding should be displayed
/// in relation to the button's label.
pub fn key_binding_position(mut self, position: KeybindingPosition) -> Self {
self.keybinding_position = position;
self.key_binding_position = position;
self
}
@ -427,7 +427,7 @@ impl RenderOnce for Button {
.child(
h_flex()
.when(
self.keybinding_position == KeybindingPosition::Start,
self.key_binding_position == KeybindingPosition::Start,
|this| this.flex_row_reverse(),
)
.gap(DynamicSpacing::Base06.rems(cx))

View file

@ -506,7 +506,9 @@ impl RenderOnce for ButtonLike {
.group("")
.flex_none()
.h(self.height.unwrap_or(self.size.rems().into()))
.when_some(self.width, |this, width| this.w(width).justify_center())
.when_some(self.width, |this, width| {
this.w(width).justify_center().text_center()
})
.when_some(self.rounding, |this, rounding| match rounding {
ButtonLikeRounding::All => this.rounded_md(),
ButtonLikeRounding::Left => this.rounded_l_md(),

View file

@ -22,6 +22,7 @@ pub struct IconButton {
icon_size: IconSize,
icon_color: Color,
selected_icon: Option<IconName>,
selected_icon_color: Option<Color>,
indicator: Option<Indicator>,
indicator_border_color: Option<Hsla>,
alpha: Option<f32>,
@ -36,6 +37,7 @@ impl IconButton {
icon_size: IconSize::default(),
icon_color: Color::Default,
selected_icon: None,
selected_icon_color: None,
indicator: None,
indicator_border_color: None,
alpha: None,
@ -69,6 +71,12 @@ impl IconButton {
self
}
/// Sets the icon color used when the button is in a selected state.
pub fn selected_icon_color(mut self, color: impl Into<Option<Color>>) -> Self {
self.selected_icon_color = color.into();
self
}
pub fn indicator(mut self, indicator: Indicator) -> Self {
self.indicator = Some(indicator);
self
@ -181,6 +189,7 @@ impl RenderOnce for IconButton {
.disabled(is_disabled)
.toggle_state(is_selected)
.selected_icon(self.selected_icon)
.selected_icon_color(self.selected_icon_color)
.when_some(selected_style, |this, style| this.selected_style(style))
.when_some(self.indicator, |this, indicator| {
this.indicator(indicator)