Progress use positioning layout
This commit is contained in:
parent
7c99584862
commit
138fc9c7b5
2 changed files with 13 additions and 20 deletions
|
|
@ -131,7 +131,7 @@ impl StoryWorkspace {
|
||||||
|
|
||||||
StoryContainer::add_pane(
|
StoryContainer::add_pane(
|
||||||
"Table",
|
"Table",
|
||||||
"Powerful table and datagrids built using TanStack Table.",
|
"Powerful table and datagrids built.",
|
||||||
TableStory::view(cx).into(),
|
TableStory::view(cx).into(),
|
||||||
workspace.clone(),
|
workspace.clone(),
|
||||||
cx,
|
cx,
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@ use gpui::{
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::theme::{ActiveTheme, Colorize};
|
||||||
h_flex,
|
|
||||||
theme::{ActiveTheme, Colorize},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
pub struct Progress {
|
pub struct Progress {
|
||||||
|
|
@ -37,27 +34,23 @@ impl RenderOnce for Progress {
|
||||||
v => v / 100.,
|
v => v / 100.,
|
||||||
});
|
});
|
||||||
|
|
||||||
h_flex()
|
div()
|
||||||
|
.relative()
|
||||||
.h(px(self.height))
|
.h(px(self.height))
|
||||||
|
.rounded(rounded)
|
||||||
|
.bg(cx.theme().progress_bar.opacity(0.2))
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
|
.absolute()
|
||||||
|
.top_0()
|
||||||
|
.left_0()
|
||||||
|
.h_full()
|
||||||
|
.w(relative_w)
|
||||||
|
.bg(cx.theme().progress_bar)
|
||||||
.map(|this| match self.value {
|
.map(|this| match self.value {
|
||||||
v if v >= 100. => this.rounded(rounded),
|
v if v >= 100. => this.rounded(rounded),
|
||||||
_ => this.rounded_l(rounded),
|
_ => this.rounded_l(rounded),
|
||||||
})
|
}),
|
||||||
.h_full()
|
|
||||||
.w(relative_w)
|
|
||||||
.bg(cx.theme().progress_bar),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
div()
|
|
||||||
.map(|this| match self.value {
|
|
||||||
v if v <= 0. => this.rounded(rounded),
|
|
||||||
_ => this.rounded_r(rounded),
|
|
||||||
})
|
|
||||||
.h_full()
|
|
||||||
.flex_1()
|
|
||||||
.bg(cx.theme().progress_bar.opacity(0.2)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue