git_ui: Prevent button overflow due to long names (#25940)
- Fix component preview widths for git panel - Fix buttons getting pushed off the screen in git panel Release Notes: - N/A --------- Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
b2add8c803
commit
16ab8701a2
13 changed files with 283 additions and 148 deletions
|
@ -57,7 +57,7 @@ pub trait LabelCommon {
|
|||
fn alpha(self, alpha: f32) -> Self;
|
||||
|
||||
/// Truncates overflowing text with an ellipsis (`…`) if needed.
|
||||
fn text_ellipsis(self) -> Self;
|
||||
fn truncate(self) -> Self;
|
||||
|
||||
/// Sets the label to render as a single line.
|
||||
fn single_line(self) -> Self;
|
||||
|
@ -84,7 +84,7 @@ pub struct LabelLike {
|
|||
alpha: Option<f32>,
|
||||
underline: bool,
|
||||
single_line: bool,
|
||||
text_ellipsis: bool,
|
||||
truncate: bool,
|
||||
}
|
||||
|
||||
impl Default for LabelLike {
|
||||
|
@ -109,7 +109,7 @@ impl LabelLike {
|
|||
alpha: None,
|
||||
underline: false,
|
||||
single_line: false,
|
||||
text_ellipsis: false,
|
||||
truncate: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,8 +166,9 @@ impl LabelCommon for LabelLike {
|
|||
self
|
||||
}
|
||||
|
||||
fn text_ellipsis(mut self) -> Self {
|
||||
self.text_ellipsis = true;
|
||||
/// Truncates overflowing text with an ellipsis (`…`) if needed.
|
||||
fn truncate(mut self) -> Self {
|
||||
self.truncate = true;
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -220,7 +221,7 @@ impl RenderOnce for LabelLike {
|
|||
})
|
||||
.when(self.strikethrough, |this| this.line_through())
|
||||
.when(self.single_line, |this| this.whitespace_nowrap())
|
||||
.when(self.text_ellipsis, |this| {
|
||||
.when(self.truncate, |this| {
|
||||
this.overflow_x_hidden().text_ellipsis()
|
||||
})
|
||||
.text_color(color)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue