T12a Data Display: badges, tags, avatars, statistics (review pending: codex 401)

This commit is contained in:
ZacharyZhang-NY committed 2026-09-25 18:41:58 -04:00
1 parent 76da4bd39e
commit dc1d282fca
24 files changed
+1434 -83

No files matched your search

+10 -2
View File
@@ -1,5 +1,5 @@
use gpui::{
Animation, AnimationExt, App, ElementId, InteractiveElement, IntoElement, ParentElement,
Animation, AnimationExt, App, ElementId, Hsla, InteractiveElement, IntoElement, ParentElement,
RenderOnce, SharedString, Styled, Window, div,
};
@@ -33,6 +33,7 @@ pub struct AnimatedNumber {
value: f64,
decimals: usize,
pad: usize,
color: Option<Hsla>,
tween: Tween,
size: TextSize,
}
@@ -44,6 +45,7 @@ impl AnimatedNumber {
value,
decimals: 0,
pad: 0,
color: None,
tween: Tween::Roll,
size: TextSize::Xxl,
}
@@ -60,6 +62,12 @@ impl AnimatedNumber {
self
}
/// Defaults to the text color.
pub fn color(mut self, color: Hsla) -> Self {
self.color = Some(color);
self
}
/// Counts through the values instead of rolling digits.
pub fn count_up(mut self) -> Self {
self.tween = Tween::Count;
@@ -124,7 +132,7 @@ impl RenderOnce for AnimatedNumber {
.overflow_hidden()
.text_size(size)
.line_height(line)
.text_color(theme.colors.fg);
.text_color(self.color.unwrap_or(theme.colors.fg));
if self.tween == Tween::Count {
return row.child(div().with_animation(