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
|
@ -1,6 +1,6 @@
|
|||
use gpui::{AnyView, DefiniteLength};
|
||||
|
||||
use crate::{prelude::*, IconPosition, KeyBinding};
|
||||
use crate::{prelude::*, IconPosition, KeyBinding, Spacing};
|
||||
use crate::{
|
||||
ButtonCommon, ButtonLike, ButtonSize, ButtonStyle, IconName, IconSize, Label, LineHeightStyle,
|
||||
};
|
||||
|
@ -344,7 +344,7 @@ impl ButtonCommon for Button {
|
|||
|
||||
impl RenderOnce for Button {
|
||||
#[allow(refining_impl_trait)]
|
||||
fn render(self, _cx: &mut WindowContext) -> ButtonLike {
|
||||
fn render(self, cx: &mut WindowContext) -> ButtonLike {
|
||||
let is_disabled = self.base.disabled;
|
||||
let is_selected = self.base.selected;
|
||||
|
||||
|
@ -363,7 +363,7 @@ impl RenderOnce for Button {
|
|||
|
||||
self.base.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.gap(Spacing::Small.rems(cx))
|
||||
.when(self.icon_position == Some(IconPosition::Start), |this| {
|
||||
this.children(self.icon.map(|icon| {
|
||||
ButtonIcon::new(icon)
|
||||
|
@ -376,7 +376,7 @@ impl RenderOnce for Button {
|
|||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.gap(Spacing::Medium.rems(cx))
|
||||
.justify_between()
|
||||
.child(
|
||||
Label::new(label)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue