Git · rows: trailing words give way before actions, which keep their room; row actions tested by key
This commit is contained in:
2 files changed
+28
-5
No files matched your search
+13
-1
@@ -70,12 +70,19 @@ impl Render for Lists {
|
|||||||
commit: "a1".into(),
|
commit: "a1".into(),
|
||||||
when: "today".into(),
|
when: "today".into(),
|
||||||
};
|
};
|
||||||
let tagged = self.heard.clone();
|
let (tagged, switched, deleted) =
|
||||||
|
(self.heard.clone(), self.heard.clone(), self.heard.clone());
|
||||||
frame
|
frame
|
||||||
.child(
|
.child(
|
||||||
BranchList::new("branches", [branch("main", true), branch("side", false)])
|
BranchList::new("branches", [branch("main", true), branch("side", false)])
|
||||||
.on_pick(move |name, _, _| {
|
.on_pick(move |name, _, _| {
|
||||||
pick.borrow_mut().picked.push(name.to_string())
|
pick.borrow_mut().picked.push(name.to_string())
|
||||||
|
})
|
||||||
|
.on_switch(move |name, _, _| {
|
||||||
|
switched.borrow_mut().picked.push(format!("switch {name}"))
|
||||||
|
})
|
||||||
|
.on_delete(move |name, _, _| {
|
||||||
|
deleted.borrow_mut().picked.push(format!("delete {name}"))
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.child(TagList::new("tags", [tag]).on_pick(move |name, _, _| {
|
.child(TagList::new("tags", [tag]).on_pick(move |name, _, _| {
|
||||||
@@ -206,4 +213,9 @@ fn branches_and_tags_pick_from_the_keyboard(cx: &mut TestAppContext) {
|
|||||||
picked.contains(&"side".to_string()) && picked.contains(&"v1".to_string()),
|
picked.contains(&"side".to_string()) && picked.contains(&"v1".to_string()),
|
||||||
"{picked:?}"
|
"{picked:?}"
|
||||||
);
|
);
|
||||||
|
let acted = |what: &str| picked.iter().any(|said| said == what);
|
||||||
|
assert!(
|
||||||
|
acted("switch side") && acted("delete side"),
|
||||||
|
"row actions answer: {picked:?}"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
+15
-4
@@ -248,13 +248,24 @@ pub(super) fn listed(
|
|||||||
.text_color(colors.fg_subtle)
|
.text_color(colors.fg_subtle)
|
||||||
.child(Ellipsis::new(detail)),
|
.child(Ellipsis::new(detail)),
|
||||||
)
|
)
|
||||||
.children(
|
// Narrow, the trailing words give way before the actions.
|
||||||
trailing
|
.child(
|
||||||
.into_iter()
|
div()
|
||||||
.map(|words| tabular(div().flex_none().text_color(colors.fg_subtle)).child(words)),
|
.flex_shrink(1.0)
|
||||||
|
.min_w_0()
|
||||||
|
.overflow_hidden()
|
||||||
|
.whitespace_nowrap()
|
||||||
|
.flex()
|
||||||
|
.gap_2()
|
||||||
|
.children(
|
||||||
|
trailing
|
||||||
|
.into_iter()
|
||||||
|
.map(|words| tabular(div().text_color(colors.fg_subtle)).child(words)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
|
.flex_none()
|
||||||
.flex()
|
.flex()
|
||||||
.opacity(0.)
|
.opacity(0.)
|
||||||
.group_hover(group, |actions| actions.opacity(1.))
|
.group_hover(group, |actions| actions.opacity(1.))
|
||||||
|
|||||||
Reference in new issue
Block a user