From 950e6988341e74e3a4ffde519d007a85568daf93 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 28 Aug 2024 10:47:43 -0400 Subject: [PATCH] extensions_ui: Truncate long text with an ellipsis (#17007) This PR updates the extensions UI to truncate long text with an ellipsis. | Before | After | | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | Screenshot 2024-08-28 at 10 25 29 AM | Screenshot 2024-08-28 at 10 21 42 AM | Release Notes: - Improved the truncation of long author lists and descriptions in the extensions view. --- crates/extensions_ui/src/extensions_ui.rs | 57 +++++++++++++---------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index 19b10bafc9a649d860d1cbf3bfc3f98db2ddd169..1fc1c2df49137fea5dedd59bbc0c6b40bfeec6ac 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -452,28 +452,34 @@ impl ExtensionsPage { ) .child( h_flex() + .gap_2() .justify_between() .child( - Label::new(format!( - "{}: {}", - if extension.authors.len() > 1 { - "Authors" - } else { - "Author" - }, - extension.authors.join(", ") - )) - .size(LabelSize::Small), + div().overflow_x_hidden().text_ellipsis().child( + Label::new(format!( + "{}: {}", + if extension.authors.len() > 1 { + "Authors" + } else { + "Author" + }, + extension.authors.join(", ") + )) + .size(LabelSize::Small), + ), ) .child(Label::new("<>").size(LabelSize::Small)), ) .child( h_flex() + .gap_2() .justify_between() .children(extension.description.as_ref().map(|description| { - Label::new(description.clone()) - .size(LabelSize::Small) - .color(Color::Default) + div().overflow_x_hidden().text_ellipsis().child( + Label::new(description.clone()) + .size(LabelSize::Small) + .color(Color::Default), + ) })) .children(repository_url.map(|repository_url| { IconButton::new( @@ -547,18 +553,21 @@ impl ExtensionsPage { ) .child( h_flex() + .gap_2() .justify_between() .child( - Label::new(format!( - "{}: {}", - if extension.manifest.authors.len() > 1 { - "Authors" - } else { - "Author" - }, - extension.manifest.authors.join(", ") - )) - .size(LabelSize::Small), + div().overflow_x_hidden().text_ellipsis().child( + Label::new(format!( + "{}: {}", + if extension.manifest.authors.len() > 1 { + "Authors" + } else { + "Author" + }, + extension.manifest.authors.join(", ") + )) + .size(LabelSize::Small), + ), ) .child( Label::new(format!( @@ -573,7 +582,7 @@ impl ExtensionsPage { .gap_2() .justify_between() .children(extension.manifest.description.as_ref().map(|description| { - h_flex().overflow_x_hidden().child( + div().overflow_x_hidden().text_ellipsis().child( Label::new(description.clone()) .size(LabelSize::Small) .color(Color::Default),