add ui_text_size
functions
This commit is contained in:
parent
c67f78c065
commit
6e11044e9e
2 changed files with 22 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
use gpui::{relative, rems, Hsla, WindowContext};
|
||||
use gpui::{relative, Hsla, WindowContext};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
@ -85,7 +85,7 @@ impl Label {
|
|||
.bg(LabelColor::Hidden.hsla(cx)),
|
||||
)
|
||||
})
|
||||
.text_size(rems(1.))
|
||||
.text_size(ui_text_default())
|
||||
.when(self.line_height_style == LineHeightStyle::UILabel, |this| {
|
||||
this.line_height(relative(1.))
|
||||
})
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use gpui::rems;
|
||||
use gpui::Rems;
|
||||
pub use gpui::{
|
||||
div, Component, Element, ElementId, ParentElement, SharedString, StatefulInteractive,
|
||||
StatelessInteractive, Styled, ViewContext, WindowContext,
|
||||
|
@ -73,6 +75,24 @@ impl std::fmt::Display for GitStatus {
|
|||
}
|
||||
}
|
||||
|
||||
/// The default text size for UI text
|
||||
///
|
||||
/// At a default 16px per rem, this is 14px.
|
||||
///
|
||||
/// Use [`ui_text_sm`] for smaller text.
|
||||
pub fn ui_text_default() -> Rems {
|
||||
rems(0.875)
|
||||
}
|
||||
|
||||
/// The small text size for UI text
|
||||
///
|
||||
/// At a default 16px per rem, this is 12px.
|
||||
///
|
||||
/// Use [`ui_text_default`] for regular-sized text.
|
||||
pub fn ui_text_sm() -> Rems {
|
||||
rems(0.75)
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)]
|
||||
pub enum DiagnosticStatus {
|
||||
#[default]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue