project_panel: Fix validation error style alignment (#28214)

Use px over rem for positioning as rem is dependent on font
size.

Release Notes:

- N/A
This commit is contained in:
Smit Barmase 2025-04-07 17:03:21 +05:30 committed by GitHub
parent d6d9c383cb
commit 3b46fca64c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,7 +22,7 @@ use gpui::{
Hsla, InteractiveElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior,
MouseButton, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, ScrollStrategy,
Stateful, Styled, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, actions,
anchored, deferred, div, impl_actions, point, px, size, transparent_black, uniform_list,
anchored, deferred, div, impl_actions, point, px, size, uniform_list,
};
use indexmap::IndexMap;
use language::DiagnosticSeverity;
@ -4178,23 +4178,17 @@ impl ProjectPanel {
.overflow_x(),
)
.when(
validation_error, |el| {
el
validation_error, |this| {
this
.relative()
.child(
deferred(
// Wizardry of highest order to make error border align with entry border
div()
.occlude()
.absolute()
.top_full()
.left_neg_0p5()
.right_neg_1()
.border_x_1()
.border_color(transparent_black())
.child(
div()
.left(px(-1.)) // Used px over rem so that it doesn't change with font size
.right(px(-0.5))
.py_1()
.px_2()
.border_1()
@ -4204,10 +4198,9 @@ impl ProjectPanel {
Label::new(format!("{} already exists", self.filename_editor.read(cx).text(cx)))
.color(Color::Error)
.size(LabelSize::Small)
.truncate()
)
)
)
)
}
)