New commit review flow in project diff view (#25229)
Closes #ISSUE Release Notes: - N/A --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
parent
6b9397c380
commit
4871d3c9e7
18 changed files with 982 additions and 480 deletions
|
@ -11,14 +11,14 @@ pub fn content_group() -> ContentGroup {
|
|||
/// A [ContentGroup] that vertically stacks its children.
|
||||
///
|
||||
/// This is a convenience function that simply combines [`ContentGroup`] and [`v_flex`](crate::v_flex).
|
||||
pub fn v_group() -> ContentGroup {
|
||||
pub fn v_container() -> ContentGroup {
|
||||
content_group().v_flex()
|
||||
}
|
||||
|
||||
/// Creates a new horizontal [ContentGroup].
|
||||
///
|
||||
/// This is a convenience function that simply combines [`ContentGroup`] and [`h_flex`](crate::h_flex).
|
||||
pub fn h_group() -> ContentGroup {
|
||||
pub fn h_container() -> ContentGroup {
|
||||
content_group().h_flex()
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,24 @@ use gpui::{Hsla, IntoElement};
|
|||
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn divider() -> Divider {
|
||||
Divider {
|
||||
style: DividerStyle::Solid,
|
||||
direction: DividerDirection::Horizontal,
|
||||
color: DividerColor::default(),
|
||||
inset: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn vertical_divider() -> Divider {
|
||||
Divider {
|
||||
style: DividerStyle::Solid,
|
||||
direction: DividerDirection::Vertical,
|
||||
color: DividerColor::default(),
|
||||
inset: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
enum DividerStyle {
|
||||
Solid,
|
||||
|
|
57
crates/ui/src/components/group.rs
Normal file
57
crates/ui/src/components/group.rs
Normal file
|
@ -0,0 +1,57 @@
|
|||
use gpui::{div, prelude::*, Div};
|
||||
|
||||
/// Creates a horizontal group with tight, consistent spacing.
|
||||
///
|
||||
/// xs: ~2px @16px/rem
|
||||
pub fn h_group_sm() -> Div {
|
||||
div().flex().gap_0p5()
|
||||
}
|
||||
|
||||
/// Creates a horizontal group with consistent spacing.
|
||||
///
|
||||
/// s: ~4px @16px/rem
|
||||
pub fn h_group() -> Div {
|
||||
div().flex().gap_1()
|
||||
}
|
||||
|
||||
/// Creates a horizontal group with consistent spacing.
|
||||
///
|
||||
/// m: ~6px @16px/rem
|
||||
pub fn h_group_lg() -> Div {
|
||||
div().flex().gap_1p5()
|
||||
}
|
||||
|
||||
/// Creates a horizontal group with consistent spacing.
|
||||
///
|
||||
/// l: ~8px @16px/rem
|
||||
pub fn h_group_xl() -> Div {
|
||||
div().flex().gap_2()
|
||||
}
|
||||
|
||||
/// Creates a vertical group with tight, consistent spacing.
|
||||
///
|
||||
/// xs: ~2px @16px/rem
|
||||
pub fn v_group_sm() -> Div {
|
||||
div().flex().flex_col().gap_0p5()
|
||||
}
|
||||
|
||||
/// Creates a vertical group with consistent spacing.
|
||||
///
|
||||
/// s: ~4px @16px/rem
|
||||
pub fn v_group() -> Div {
|
||||
div().flex().flex_col().gap_1()
|
||||
}
|
||||
|
||||
/// Creates a vertical group with consistent spacing.
|
||||
///
|
||||
/// m: ~6px @16px/rem
|
||||
pub fn v_group_lg() -> Div {
|
||||
div().flex().flex_col().gap_1p5()
|
||||
}
|
||||
|
||||
/// Creates a vertical group with consistent spacing.
|
||||
///
|
||||
/// l: ~8px @16px/rem
|
||||
pub fn v_group_xl() -> Div {
|
||||
div().flex().flex_col().gap_2()
|
||||
}
|
|
@ -52,6 +52,24 @@ impl Tooltip {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn for_action_title_in(
|
||||
title: impl Into<SharedString>,
|
||||
action: &dyn Action,
|
||||
focus_handle: &FocusHandle,
|
||||
) -> impl Fn(&mut Window, &mut App) -> AnyView {
|
||||
let title = title.into();
|
||||
let action = action.boxed_clone();
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
cx.new(|cx| Self {
|
||||
title: title.clone(),
|
||||
meta: None,
|
||||
key_binding: KeyBinding::for_action_in(action.as_ref(), &focus_handle, window, cx),
|
||||
})
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn for_action(
|
||||
title: impl Into<SharedString>,
|
||||
action: &dyn Action,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue