From ce62404e24e019247538220af42748de28b93038 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 5 Feb 2024 13:21:07 -0500 Subject: [PATCH] Correctly use the base element in `HighlightedLabel` (#7397) This PR updates the `HighlightedLabel` to correctly render its base element, which is the one that receives the styling properties, instead of rendering a new `LabelLike`. Release Notes: - N/A --- crates/ui/src/components/label/highlighted_label.rs | 3 +-- crates/ui/src/components/label/label_like.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/components/label/highlighted_label.rs b/crates/ui/src/components/label/highlighted_label.rs index 41866bd10a..88174f4895 100644 --- a/crates/ui/src/components/label/highlighted_label.rs +++ b/crates/ui/src/components/label/highlighted_label.rs @@ -79,8 +79,7 @@ impl RenderOnce for HighlightedLabel { let mut text_style = cx.text_style().clone(); text_style.color = self.base.color.color(cx); - LabelLike::new() - .size(self.base.size) + self.base .child(StyledText::new(self.label).with_highlights(&text_style, highlights)) } } diff --git a/crates/ui/src/components/label/label_like.rs b/crates/ui/src/components/label/label_like.rs index f08ff1bf83..cddd849b89 100644 --- a/crates/ui/src/components/label/label_like.rs +++ b/crates/ui/src/components/label/label_like.rs @@ -36,7 +36,7 @@ pub trait LabelCommon { #[derive(IntoElement)] pub struct LabelLike { - pub(crate) size: LabelSize, + size: LabelSize, line_height_style: LineHeightStyle, pub(crate) color: Color, strikethrough: bool,