Git · row actions always shown: refs rows put them by the name, the words below; changes rows keep them in reach
This commit is contained in:
2 files changed
+13
-36
No files matched your search
+1
-5
@@ -216,12 +216,8 @@ impl ChangesList {
|
|||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.id("actions")
|
.flex_none()
|
||||||
.focusable()
|
|
||||||
.in_focus(|actions| actions.opacity(1.))
|
|
||||||
.flex()
|
.flex()
|
||||||
.opacity(0.)
|
|
||||||
.group_hover(group, |actions| actions.opacity(1.))
|
|
||||||
.child(action(
|
.child(action(
|
||||||
"open",
|
"open",
|
||||||
IconName::FileText,
|
IconName::FileText,
|
||||||
|
|||||||
+12
-31
@@ -217,10 +217,8 @@ pub(super) fn listed(
|
|||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
let colors = theme.colors.clone();
|
let colors = theme.colors.clone();
|
||||||
let group = SharedString::from(format!("{id:?}"));
|
|
||||||
div()
|
div()
|
||||||
.id(id)
|
.id(id)
|
||||||
.group(group.clone())
|
|
||||||
.when_some(pick, |row, pick| {
|
.when_some(pick, |row, pick| {
|
||||||
let run = pick.run;
|
let run = pick.run;
|
||||||
row.role(Role::ListItem)
|
row.role(Role::ListItem)
|
||||||
@@ -234,7 +232,6 @@ pub(super) fn listed(
|
|||||||
.when(pick.selected, |row| row.bg(colors.selection))
|
.when(pick.selected, |row| row.bg(colors.selection))
|
||||||
.on_click(move |_, window, cx| run(window, cx))
|
.on_click(move |_, window, cx| run(window, cx))
|
||||||
})
|
})
|
||||||
.relative()
|
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
@@ -249,12 +246,12 @@ pub(super) fn listed(
|
|||||||
.min_w_0()
|
.min_w_0()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
|
// Narrow, the name gives way; actions stay in reach.
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
.gap_2()
|
.gap_1()
|
||||||
// Narrow, the name gives way; the words stay.
|
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
@@ -263,39 +260,23 @@ pub(super) fn listed(
|
|||||||
.whitespace_nowrap()
|
.whitespace_nowrap()
|
||||||
.child(name),
|
.child(name),
|
||||||
)
|
)
|
||||||
.child(
|
.child(div().flex_none().flex().children(actions)),
|
||||||
div()
|
|
||||||
.flex_none()
|
|
||||||
.flex()
|
|
||||||
.gap_2()
|
|
||||||
.group_hover(group.clone(), |words| words.opacity(0.))
|
|
||||||
.children(trailing.into_iter().map(|words| {
|
|
||||||
tabular(div().text_color(colors.fg_subtle)).child(words)
|
|
||||||
})),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.when(!detail.is_empty(), |text| {
|
.when(!detail.is_empty() || !trailing.is_empty(), |text| {
|
||||||
text.child(
|
text.child(
|
||||||
div()
|
div()
|
||||||
|
.flex()
|
||||||
|
.gap_2()
|
||||||
.text_color(colors.fg_subtle)
|
.text_color(colors.fg_subtle)
|
||||||
.child(Ellipsis::new(detail)),
|
.child(div().flex_1().min_w_0().child(Ellipsis::new(detail)))
|
||||||
|
.children(
|
||||||
|
trailing
|
||||||
|
.into_iter()
|
||||||
|
.map(|words| tabular(div().flex_none()).child(words)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
// Hover or keyboard focus shows the actions.
|
|
||||||
.child(
|
|
||||||
div()
|
|
||||||
.id("actions")
|
|
||||||
.focusable()
|
|
||||||
.in_focus(|actions| actions.opacity(1.))
|
|
||||||
.absolute()
|
|
||||||
.top_0p5()
|
|
||||||
.right_1()
|
|
||||||
.flex()
|
|
||||||
.opacity(0.)
|
|
||||||
.group_hover(group, |actions| actions.opacity(1.))
|
|
||||||
.children(actions),
|
|
||||||
)
|
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user