Document more enums

This commit is contained in:
Nate Butler 2024-01-09 14:50:04 -05:00
parent c19551d974
commit 51988f63d5
6 changed files with 10 additions and 5 deletions

View file

@ -95,6 +95,7 @@ impl From<ButtonStyle> for Color {
} }
} }
/// Sets the visual appearance of a button.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)]
pub enum ButtonStyle { pub enum ButtonStyle {
/// A filled button with a solid background color. Provides emphasis versus /// A filled button with a solid background color. Provides emphasis versus
@ -262,8 +263,7 @@ impl ButtonStyle {
} }
} }
/// ButtonSize can also be used to help build non-button elements /// Sets the height of a button. Can also be used to size non-button elements to align with [Button]s.
/// that are consistently sized with buttons.
#[derive(Default, PartialEq, Clone, Copy)] #[derive(Default, PartialEq, Clone, Copy)]
pub enum ButtonSize { pub enum ButtonSize {
Large, Large,

View file

@ -7,6 +7,7 @@ enum DividerDirection {
Vertical, Vertical,
} }
/// Sets the color of a [Divider].
#[derive(Default)] #[derive(Default)]
pub enum DividerColor { pub enum DividerColor {
Border, Border,

View file

@ -30,6 +30,7 @@ pub trait StyledExt: Styled + Sized {
self.flex().flex_col() self.flex().flex_col()
} }
/// Sets the text size using a [UiTextSize].
fn text_ui_size(self, size: UiTextSize) -> Self { fn text_ui_size(self, size: UiTextSize) -> Self {
self.text_size(size.rems()) self.text_size(size.rems())
} }
@ -40,7 +41,7 @@ pub trait StyledExt: Styled + Sized {
/// ///
/// Note: The absolute size of this text will change based on a user's `ui_scale` setting. /// Note: The absolute size of this text will change based on a user's `ui_scale` setting.
/// ///
/// Use [`text_ui_sm`] for regular-sized text. /// Use `text_ui_sm` for smaller text.
fn text_ui(self) -> Self { fn text_ui(self) -> Self {
self.text_size(UiTextSize::default().rems()) self.text_size(UiTextSize::default().rems())
} }
@ -51,7 +52,7 @@ pub trait StyledExt: Styled + Sized {
/// ///
/// Note: The absolute size of this text will change based on a user's `ui_scale` setting. /// Note: The absolute size of this text will change based on a user's `ui_scale` setting.
/// ///
/// Use [`text_ui`] for regular-sized text. /// Use `text_ui` for regular-sized text.
fn text_ui_sm(self) -> Self { fn text_ui_sm(self) -> Self {
self.text_size(UiTextSize::Small.rems()) self.text_size(UiTextSize::Small.rems())
} }
@ -62,7 +63,7 @@ pub trait StyledExt: Styled + Sized {
/// ///
/// Note: The absolute size of this text will change based on a user's `ui_scale` setting. /// Note: The absolute size of this text will change based on a user's `ui_scale` setting.
/// ///
/// Use [`text_ui`] for regular-sized text. /// Use `text_ui` for regular-sized text.
fn text_ui_xs(self) -> Self { fn text_ui_xs(self) -> Self {
self.text_size(UiTextSize::XSmall.rems()) self.text_size(UiTextSize::XSmall.rems())
} }

View file

@ -1,6 +1,7 @@
use gpui::{Hsla, WindowContext}; use gpui::{Hsla, WindowContext};
use theme::ActiveTheme; use theme::ActiveTheme;
/// Sets a color that has a consistent meaning across all themes.
#[derive(Debug, Default, PartialEq, Copy, Clone)] #[derive(Debug, Default, PartialEq, Copy, Clone)]
pub enum Color { pub enum Color {
#[default] #[default]

View file

@ -85,6 +85,7 @@ impl LayerIndex {
} }
} }
/// Sets ann appropriate z-index for the given layer based on it's intended useage.
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ElementIndex { pub enum ElementIndex {
Effect, Effect,

View file

@ -38,6 +38,7 @@ impl UiTextSize {
} }
} }
/// Sets the size of a [Headline] element
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)]
pub enum HeadlineSize { pub enum HeadlineSize {
XSmall, XSmall,