Add wiring for UI density (#11260)
Note: You shouldn't use the `unstable.ui_density` setting – it is only being added for testing and to enable new UI components to be built with density in mind. Don't expect this to work well, or at all right now. Adds some of the basic wiring we'll need to start scaling UI elements throughout the app based on a desired density setting. Release Notes: - N/A
This commit is contained in:
parent
0fce20d8da
commit
97512be378
13 changed files with 209 additions and 78 deletions
|
@ -37,10 +37,10 @@ impl Render for StatusBar {
|
|||
h_flex()
|
||||
.w_full()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
.py_0p5()
|
||||
.px_1()
|
||||
.h_8()
|
||||
.gap(Spacing::Large.rems(cx))
|
||||
.py(Spacing::Small.rems(cx))
|
||||
.px(Spacing::Large.rems(cx))
|
||||
// .h_8()
|
||||
.bg(cx.theme().colors().status_bar_background)
|
||||
.child(self.render_left_tools(cx))
|
||||
.child(self.render_right_tools(cx))
|
||||
|
@ -48,16 +48,16 @@ impl Render for StatusBar {
|
|||
}
|
||||
|
||||
impl StatusBar {
|
||||
fn render_left_tools(&self, _: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
fn render_left_tools(&self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.gap(Spacing::Large.rems(cx))
|
||||
.overflow_x_hidden()
|
||||
.children(self.left_items.iter().map(|item| item.to_any()))
|
||||
}
|
||||
|
||||
fn render_right_tools(&self, _: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
fn render_right_tools(&self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.gap(Spacing::Large.rems(cx))
|
||||
.children(self.right_items.iter().rev().map(|item| item.to_any()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,15 +104,17 @@ impl Render for Toolbar {
|
|||
let has_right_items = self.right_items().count() > 0;
|
||||
|
||||
v_flex()
|
||||
.p_2()
|
||||
.when(has_left_items || has_right_items, |this| this.gap_2())
|
||||
.p(Spacing::Large.rems(cx))
|
||||
.when(has_left_items || has_right_items, |this| {
|
||||
this.gap(Spacing::Large.rems(cx))
|
||||
})
|
||||
.border_b()
|
||||
.border_color(cx.theme().colors().border_variant)
|
||||
.bg(cx.theme().colors().toolbar_background)
|
||||
.child(
|
||||
h_flex()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
.gap(Spacing::Large.rems(cx))
|
||||
.when(has_left_items, |this| {
|
||||
this.child(
|
||||
h_flex()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue