Commit All Mode (#24293)
- **Base diffs on uncommitted changes** - **Show added files in project diff view** - **Fix git panel optimism** - **boop** - **Co-Authored-By: Cole <cole@zed.dev>** - **Fix commit (all) buttons state** - **WIP** - **WIP: commit all mode** Closes #ISSUE Release Notes: - N/A
This commit is contained in:
@@ -164,6 +164,7 @@ pub enum IconName {
|
||||
ChevronRight,
|
||||
ChevronUp,
|
||||
ChevronUpDown,
|
||||
Circle,
|
||||
Close,
|
||||
Code,
|
||||
Command,
|
||||
|
||||
@@ -43,6 +43,7 @@ pub struct Checkbox {
|
||||
id: ElementId,
|
||||
toggle_state: ToggleState,
|
||||
disabled: bool,
|
||||
placeholder: bool,
|
||||
on_click: Option<Box<dyn Fn(&ToggleState, &mut Window, &mut App) + 'static>>,
|
||||
filled: bool,
|
||||
style: ToggleStyle,
|
||||
@@ -62,6 +63,7 @@ impl Checkbox {
|
||||
style: ToggleStyle::default(),
|
||||
tooltip: None,
|
||||
label: None,
|
||||
placeholder: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +73,12 @@ impl Checkbox {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the disabled state of the [`Checkbox`].
|
||||
pub fn placeholder(mut self, placeholder: bool) -> Self {
|
||||
self.placeholder = placeholder;
|
||||
self
|
||||
}
|
||||
|
||||
/// Binds a handler to the [`Checkbox`] that will be called when clicked.
|
||||
pub fn on_click(
|
||||
mut self,
|
||||
@@ -145,23 +153,26 @@ impl Checkbox {
|
||||
impl RenderOnce for Checkbox {
|
||||
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let group_id = format!("checkbox_group_{:?}", self.id);
|
||||
let color = if self.disabled {
|
||||
Color::Disabled
|
||||
} else if self.placeholder {
|
||||
Color::Placeholder
|
||||
} else {
|
||||
Color::Selected
|
||||
};
|
||||
let icon = match self.toggle_state {
|
||||
ToggleState::Selected => Some(Icon::new(IconName::Check).size(IconSize::Small).color(
|
||||
if self.disabled {
|
||||
Color::Disabled
|
||||
} else {
|
||||
Color::Selected
|
||||
},
|
||||
)),
|
||||
ToggleState::Indeterminate => Some(
|
||||
Icon::new(IconName::Dash)
|
||||
ToggleState::Selected => Some(if self.placeholder {
|
||||
Icon::new(IconName::Circle)
|
||||
.size(IconSize::XSmall)
|
||||
.color(color)
|
||||
} else {
|
||||
Icon::new(IconName::Check)
|
||||
.size(IconSize::Small)
|
||||
.color(if self.disabled {
|
||||
Color::Disabled
|
||||
} else {
|
||||
Color::Selected
|
||||
}),
|
||||
),
|
||||
.color(color)
|
||||
}),
|
||||
ToggleState::Indeterminate => {
|
||||
Some(Icon::new(IconName::Dash).size(IconSize::Small).color(color))
|
||||
}
|
||||
ToggleState::Unselected => None,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user