From b73440873f2ef16fde2ca32fac8e40a37d38b568 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 20 Feb 2025 22:13:45 -0500 Subject: [PATCH] Continue on component preview --- .../src/component_preview.rs | 1 - crates/ui/src/components/avatar.rs | 2 +- crates/ui/src/components/button/button.rs | 26 ++- .../ui/src/components/button/button_icon.rs | 1 - .../ui/src/components/button/button_like.rs | 1 - .../ui/src/components/button/icon_button.rs | 163 +++++++++++++++++- .../ui/src/components/button/toggle_button.rs | 131 +++++++++++++- crates/ui/src/components/context_menu.rs | 1 - crates/ui/src/components/disclosure.rs | 1 - crates/ui/src/components/divider.rs | 1 - crates/ui/src/components/dropdown_menu.rs | 1 - crates/ui/src/components/facepile.rs | 113 ++++++------ crates/ui/src/components/icon.rs | 2 - crates/ui/src/components/image.rs | 1 - crates/ui/src/components/indent_guides.rs | 1 - crates/ui/src/components/indicator.rs | 1 - crates/ui/src/components/keybinding.rs | 1 - .../src/components/label/highlighted_label.rs | 2 - crates/ui/src/components/list/list.rs | 2 - crates/ui/src/components/list/list_header.rs | 2 - crates/ui/src/components/list/list_item.rs | 2 - .../ui/src/components/list/list_separator.rs | 2 - .../ui/src/components/list/list_sub_header.rs | 2 - crates/ui/src/components/modal.rs | 2 - crates/ui/src/components/numeric_stepper.rs | 2 - crates/ui/src/components/popover.rs | 2 - crates/ui/src/components/popover_menu.rs | 2 - crates/ui/src/components/radio.rs | 2 - crates/ui/src/components/right_click_menu.rs | 2 - crates/ui/src/components/scrollbar.rs | 1 - .../ui/src/components/settings_container.rs | 2 - crates/ui/src/components/settings_group.rs | 2 - crates/ui/src/components/stack.rs | 2 - crates/ui/src/components/stories.rs | 1 - crates/ui/src/components/tab.rs | 1 - crates/ui/src/components/tab_bar.rs | 1 - crates/ui/src/components/tooltip.rs | 2 - crates/ui/src/styles/typography.rs | 65 ++++--- crates/ui/src/utils/format_distance.rs | 1 - crates/ui/src/utils/search_input.rs | 2 - 40 files changed, 387 insertions(+), 165 deletions(-) diff --git a/crates/component_preview/src/component_preview.rs b/crates/component_preview/src/component_preview.rs index e462e9021bb06d..6a3dcfc406aa17 100644 --- a/crates/component_preview/src/component_preview.rs +++ b/crates/component_preview/src/component_preview.rs @@ -106,7 +106,6 @@ impl ComponentPreview { .py_2() .child( v_flex() - .bg(cx.theme().colors().text.opacity(0.05)) .border_1() .border_color(cx.theme().colors().border) .rounded_md() diff --git a/crates/ui/src/components/avatar.rs b/crates/ui/src/components/avatar.rs index 8105ce4c9663b5..b0670d04c056de 100644 --- a/crates/ui/src/components/avatar.rs +++ b/crates/ui/src/components/avatar.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, Indicator}; +use crate::prelude::*; use gpui::{img, AnyElement, Hsla, ImageSource, Img, IntoElement, Styled}; diff --git a/crates/ui/src/components/button/button.rs b/crates/ui/src/components/button/button.rs index 58a3d5ae9175ee..e7112aa8aec509 100644 --- a/crates/ui/src/components/button/button.rs +++ b/crates/ui/src/components/button/button.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use component::{example_group_with_title, single_example, ComponentPreview}; use gpui::{AnyElement, AnyView, DefiniteLength}; use ui_macros::IntoComponent; @@ -81,6 +80,7 @@ use super::button_icon::ButtonIcon; /// ``` /// #[derive(IntoElement, IntoComponent)] +#[component(scope = "input")] pub struct Button { base: ButtonLike, label: SharedString, @@ -463,7 +463,7 @@ impl ComponentPreview for Button { .gap_6() .children(vec![ example_group_with_title( - "Styles", + "Button Styles", vec![ single_example( "Default", @@ -481,6 +481,12 @@ impl ComponentPreview for Button { .style(ButtonStyle::Subtle) .into_any_element(), ), + single_example( + "Tinted", + Button::new("tinted_accent_style", "Accent") + .style(ButtonStyle::Tinted(TintColor::Accent)) + .into_any_element(), + ), single_example( "Transparent", Button::new("transparent", "Transparent") @@ -490,7 +496,7 @@ impl ComponentPreview for Button { ], ), example_group_with_title( - "Tinted", + "Tint Styles", vec![ single_example( "Accent", @@ -519,7 +525,7 @@ impl ComponentPreview for Button { ], ), example_group_with_title( - "States", + "Special States", vec![ single_example( "Default", @@ -540,7 +546,7 @@ impl ComponentPreview for Button { ], ), example_group_with_title( - "With Icons", + "Buttons with Icons", vec![ single_example( "Icon Start", @@ -563,16 +569,6 @@ impl ComponentPreview for Button { .icon_color(Color::Accent) .into_any_element(), ), - single_example( - "Tinted Icons", - Button::new("tinted_icons", "Error") - .style(ButtonStyle::Tinted(TintColor::Error)) - .color(Color::Error) - .icon_color(Color::Error) - .icon(IconName::Trash) - .icon_position(IconPosition::Start) - .into_any_element(), - ), ], ), ]) diff --git a/crates/ui/src/components/button/button_icon.rs b/crates/ui/src/components/button/button_icon.rs index adacd12f27039f..337f10700a1098 100644 --- a/crates/ui/src/components/button/button_icon.rs +++ b/crates/ui/src/components/button/button_icon.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use crate::{prelude::*, Icon, IconName, IconSize, IconWithIndicator, Indicator}; use gpui::Hsla; diff --git a/crates/ui/src/components/button/button_like.rs b/crates/ui/src/components/button/button_like.rs index 96d093c249ab4a..5503e6f865afa8 100644 --- a/crates/ui/src/components/button/button_like.rs +++ b/crates/ui/src/components/button/button_like.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use gpui::{relative, CursorStyle, DefiniteLength, MouseButton}; use gpui::{transparent_black, AnyElement, AnyView, ClickEvent, Hsla, Rems}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/button/icon_button.rs b/crates/ui/src/components/button/icon_button.rs index 204ea8e564c888..97084116057e5e 100644 --- a/crates/ui/src/components/button/icon_button.rs +++ b/crates/ui/src/components/button/icon_button.rs @@ -1,8 +1,7 @@ -#![allow(missing_docs)] use gpui::{AnyView, DefiniteLength, Hsla}; use super::button_like::{ButtonCommon, ButtonLike, ButtonSize, ButtonStyle}; -use crate::{prelude::*, ElevationIndex, Indicator, SelectableButton}; +use crate::{prelude::*, ElevationIndex, Indicator, SelectableButton, TintColor}; use crate::{IconName, IconSize}; use super::button_icon::ButtonIcon; @@ -14,7 +13,8 @@ pub enum IconButtonShape { Wide, } -#[derive(IntoElement)] +#[derive(IntoElement, IntoComponent)] +#[component(scope = "input")] pub struct IconButton { base: ButtonLike, shape: IconButtonShape, @@ -200,3 +200,160 @@ impl RenderOnce for IconButton { ) } } + +impl ComponentPreview for IconButton { + fn preview(_window: &mut Window, _cx: &App) -> AnyElement { + v_flex() + .gap_6() + .children(vec![ + example_group_with_title( + "Icon Button Styles", + vec![ + single_example( + "Default", + IconButton::new("default", IconName::Check) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "Filled", + IconButton::new("filled", IconName::Check) + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .into_any_element(), + ), + single_example( + "Subtle", + IconButton::new("subtle", IconName::Check) + .layer(ElevationIndex::Background) + .style(ButtonStyle::Subtle) + .into_any_element(), + ), + single_example( + "Tinted", + IconButton::new("tinted", IconName::Check) + .layer(ElevationIndex::Background) + .style(ButtonStyle::Tinted(TintColor::Accent)) + .into_any_element(), + ), + single_example( + "Transparent", + IconButton::new("transparent", IconName::Check) + .layer(ElevationIndex::Background) + .style(ButtonStyle::Transparent) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Icon Button Shapes", + vec![ + single_example( + "Square", + IconButton::new("square", IconName::Check) + .shape(IconButtonShape::Square) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "Wide", + IconButton::new("wide", IconName::Check) + .shape(IconButtonShape::Wide) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Icon Button Sizes", + vec![ + single_example( + "Small", + IconButton::new("small", IconName::Check) + .icon_size(IconSize::XSmall) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "Small", + IconButton::new("small", IconName::Check) + .icon_size(IconSize::Small) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "Medium", + IconButton::new("medium", IconName::Check) + .icon_size(IconSize::Medium) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "XLarge", + IconButton::new("xlarge", IconName::Check) + .icon_size(IconSize::XLarge) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Special States", + vec![ + single_example( + "Disabled", + IconButton::new("disabled", IconName::Check) + .disabled(true) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "Selected", + IconButton::new("selected", IconName::Check) + .toggle_state(true) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "With Indicator", + IconButton::new("indicator", IconName::Check) + .indicator(Indicator::dot().color(Color::Success)) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Custom Colors", + vec![ + single_example( + "Custom Icon Color", + IconButton::new("custom_color", IconName::Check) + .icon_color(Color::Accent) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + single_example( + "With Alpha", + IconButton::new("alpha", IconName::Check) + .alpha(0.5) + .style(ButtonStyle::Filled) + .layer(ElevationIndex::Background) + .into_any_element(), + ), + ], + ), + ]) + .into_any_element() + } +} diff --git a/crates/ui/src/components/button/toggle_button.rs b/crates/ui/src/components/button/toggle_button.rs index 9681e8031bd70b..1fb8a2c01633ff 100644 --- a/crates/ui/src/components/button/toggle_button.rs +++ b/crates/ui/src/components/button/toggle_button.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use gpui::{AnyView, ClickEvent}; use crate::{prelude::*, ButtonLike, ButtonLikeRounding, ElevationIndex}; @@ -16,7 +15,8 @@ pub enum ToggleButtonPosition { Last, } -#[derive(IntoElement)] +#[derive(IntoElement, IntoComponent)] +#[component(scope = "input")] pub struct ToggleButton { base: ButtonLike, position_in_group: Option, @@ -142,3 +142,130 @@ impl RenderOnce for ToggleButton { ) } } + +impl ComponentPreview for ToggleButton { + fn preview(_window: &mut Window, _cx: &App) -> AnyElement { + v_flex() + .gap_6() + .children(vec![ + example_group_with_title( + "Button Styles", + vec![ + single_example( + "Off", + ToggleButton::new("off", "Off") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .into_any_element(), + ), + single_example( + "On", + ToggleButton::new("on", "On") + .layer(ElevationIndex::Background) + .toggle_state(true) + .style(ButtonStyle::Filled) + .into_any_element(), + ), + single_example( + "Off – Disabled", + ToggleButton::new("disabled_off", "Disabled Off") + .layer(ElevationIndex::Background) + .disabled(true) + .style(ButtonStyle::Filled) + .into_any_element(), + ), + single_example( + "On – Disabled", + ToggleButton::new("disabled_on", "Disabled On") + .layer(ElevationIndex::Background) + .disabled(true) + .toggle_state(true) + .style(ButtonStyle::Filled) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Button Group", + vec![ + single_example( + "Three Buttons", + h_flex() + .child( + ToggleButton::new("three_btn_first", "First") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .first() + .into_any_element(), + ) + .child( + ToggleButton::new("three_btn_middle", "Middle") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .middle() + .toggle_state(true) + .into_any_element(), + ) + .child( + ToggleButton::new("three_btn_last", "Last") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .last() + .into_any_element(), + ) + .into_any_element(), + ), + single_example( + "Two Buttons", + h_flex() + .child( + ToggleButton::new("two_btn_first", "First") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .first() + .into_any_element(), + ) + .child( + ToggleButton::new("two_btn_last", "Last") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .last() + .into_any_element(), + ) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Alternate Sizes", + vec![ + single_example( + "None", + ToggleButton::new("none", "None") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .size(ButtonSize::None) + .into_any_element(), + ), + single_example( + "Compact", + ToggleButton::new("compact", "Compact") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .size(ButtonSize::Compact) + .into_any_element(), + ), + single_example( + "Large", + ToggleButton::new("large", "Large") + .layer(ElevationIndex::Background) + .style(ButtonStyle::Filled) + .size(ButtonSize::Large) + .into_any_element(), + ), + ], + ), + ]) + .into_any_element() + } +} diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 03e5fa407db791..6b87bdbcd72b5c 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use crate::{ h_flex, prelude::*, utils::WithRemSize, v_flex, Icon, IconName, IconSize, KeyBinding, Label, List, ListItem, ListSeparator, ListSubHeader, diff --git a/crates/ui/src/components/disclosure.rs b/crates/ui/src/components/disclosure.rs index 036a26090e0721..c39bcf47d50b97 100644 --- a/crates/ui/src/components/disclosure.rs +++ b/crates/ui/src/components/disclosure.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use std::sync::Arc; use gpui::{ClickEvent, CursorStyle}; diff --git a/crates/ui/src/components/divider.rs b/crates/ui/src/components/divider.rs index 2a0f87a610c73d..21463bad21fb10 100644 --- a/crates/ui/src/components/divider.rs +++ b/crates/ui/src/components/divider.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use gpui::{Hsla, IntoElement}; use crate::prelude::*; diff --git a/crates/ui/src/components/dropdown_menu.rs b/crates/ui/src/components/dropdown_menu.rs index 1f2e0473af4fe1..7d2072d6c9daae 100644 --- a/crates/ui/src/components/dropdown_menu.rs +++ b/crates/ui/src/components/dropdown_menu.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use gpui::{ClickEvent, Corner, CursorStyle, Entity, MouseButton}; use crate::{prelude::*, ContextMenu, PopoverMenu}; diff --git a/crates/ui/src/components/facepile.rs b/crates/ui/src/components/facepile.rs index d965bc598a457b..59df3f4c005c9a 100644 --- a/crates/ui/src/components/facepile.rs +++ b/crates/ui/src/components/facepile.rs @@ -1,4 +1,4 @@ -use crate::prelude::*; +use crate::{prelude::*, Avatar}; use gpui::{AnyElement, StyleRefinement}; use smallvec::SmallVec; @@ -7,7 +7,7 @@ use smallvec::SmallVec; /// /// Facepiles are used to display a group of people or things, /// such as a list of participants in a collaboration session. -#[derive(IntoElement)] +#[derive(IntoElement, IntoComponent)] pub struct Facepile { base: Div, faces: SmallVec<[AnyElement; 2]>, @@ -60,60 +60,57 @@ impl RenderOnce for Facepile { } } -// impl ComponentPreview for Facepile { -// fn description() -> impl Into> { -// "A facepile is a collection of faces stacked horizontally–\ -// always with the leftmost face on top and descending in z-index.\ -// \n\nFacepiles are used to display a group of people or things,\ -// such as a list of participants in a collaboration session." -// } -// fn examples(_window: &mut Window, _: &mut App) -> Vec> { -// let few_faces: [&'static str; 3] = [ -// "https://avatars.githubusercontent.com/u/1714999?s=60&v=4", -// "https://avatars.githubusercontent.com/u/67129314?s=60&v=4", -// "https://avatars.githubusercontent.com/u/482957?s=60&v=4", -// ]; +impl ComponentPreview for Facepile { + fn preview(_window: &mut Window, _cx: &App) -> AnyElement { + let faces: [&'static str; 6] = [ + "https://avatars.githubusercontent.com/u/326587?s=60&v=4", + "https://avatars.githubusercontent.com/u/2280405?s=60&v=4", + "https://avatars.githubusercontent.com/u/1789?s=60&v=4", + "https://avatars.githubusercontent.com/u/67129314?s=60&v=4", + "https://avatars.githubusercontent.com/u/482957?s=60&v=4", + "https://avatars.githubusercontent.com/u/1714999?s=60&v=4", + ]; -// let many_faces: [&'static str; 6] = [ -// "https://avatars.githubusercontent.com/u/326587?s=60&v=4", -// "https://avatars.githubusercontent.com/u/2280405?s=60&v=4", -// "https://avatars.githubusercontent.com/u/1789?s=60&v=4", -// "https://avatars.githubusercontent.com/u/67129314?s=60&v=4", -// "https://avatars.githubusercontent.com/u/482957?s=60&v=4", -// "https://avatars.githubusercontent.com/u/1714999?s=60&v=4", -// ]; - -// vec![example_group_with_title( -// "Examples", -// vec![ -// single_example( -// "Few Faces", -// Facepile::new( -// few_faces -// .iter() -// .map(|&url| Avatar::new(url).into_any_element()) -// .collect(), -// ), -// ), -// single_example( -// "Many Faces", -// Facepile::new( -// many_faces -// .iter() -// .map(|&url| Avatar::new(url).into_any_element()) -// .collect(), -// ), -// ), -// single_example( -// "Custom Size", -// Facepile::new( -// few_faces -// .iter() -// .map(|&url| Avatar::new(url).size(px(24.)).into_any_element()) -// .collect(), -// ), -// ), -// ], -// )] -// } -// } + v_flex() + .gap_6() + .children(vec![ + example_group_with_title( + "Facepile Examples", + vec![ + single_example( + "Default", + Facepile::new( + faces + .iter() + .map(|&url| Avatar::new(url).into_any_element()) + .collect(), + ) + .into_any_element(), + ), + single_example( + "Custom Size", + Facepile::new( + faces + .iter() + .map(|&url| Avatar::new(url).size(px(24.)).into_any_element()) + .collect(), + ) + .into_any_element(), + ), + ], + ), + example_group_with_title( + "Special Cases", + vec![ + single_example("Empty Facepile", Facepile::empty().into_any_element()), + single_example( + "Single Face", + Facepile::new(vec![Avatar::new(faces[0]).into_any_element()].into()) + .into_any_element(), + ), + ], + ), + ]) + .into_any_element() + } +} diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rs index ca90a16ea7029c..ddb03071262458 100644 --- a/crates/ui/src/components/icon.rs +++ b/crates/ui/src/components/icon.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - mod decorated_icon; mod icon_decoration; diff --git a/crates/ui/src/components/image.rs b/crates/ui/src/components/image.rs index cb90b9a1e388fe..cee5cb3538ec7e 100644 --- a/crates/ui/src/components/image.rs +++ b/crates/ui/src/components/image.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use gpui::{svg, App, IntoElement, Rems, RenderOnce, Size, Styled, Window}; use serde::{Deserialize, Serialize}; use strum::{EnumIter, EnumString, IntoStaticStr}; diff --git a/crates/ui/src/components/indent_guides.rs b/crates/ui/src/components/indent_guides.rs index 87c390ef77d2e7..0d9c3f5571c3a9 100644 --- a/crates/ui/src/components/indent_guides.rs +++ b/crates/ui/src/components/indent_guides.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use std::{cmp::Ordering, ops::Range, rc::Rc}; use gpui::{ diff --git a/crates/ui/src/components/indicator.rs b/crates/ui/src/components/indicator.rs index 0cf4cab72eba99..86d1f31e409382 100644 --- a/crates/ui/src/components/indicator.rs +++ b/crates/ui/src/components/indicator.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use crate::{prelude::*, AnyIcon}; #[derive(Default)] diff --git a/crates/ui/src/components/keybinding.rs b/crates/ui/src/components/keybinding.rs index c3a3e6579d4961..13fb412e3b8f77 100644 --- a/crates/ui/src/components/keybinding.rs +++ b/crates/ui/src/components/keybinding.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use crate::PlatformStyle; use crate::{h_flex, prelude::*, Icon, IconName, IconSize}; use gpui::{ diff --git a/crates/ui/src/components/label/highlighted_label.rs b/crates/ui/src/components/label/highlighted_label.rs index a8be4624039eed..df6866aee8fad0 100644 --- a/crates/ui/src/components/label/highlighted_label.rs +++ b/crates/ui/src/components/label/highlighted_label.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use std::ops::Range; use gpui::{FontWeight, HighlightStyle, StyledText}; diff --git a/crates/ui/src/components/list/list.rs b/crates/ui/src/components/list/list.rs index 88f9c54246b19e..7cd81a51648180 100644 --- a/crates/ui/src/components/list/list.rs +++ b/crates/ui/src/components/list/list.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::AnyElement; use smallvec::SmallVec; diff --git a/crates/ui/src/components/list/list_header.rs b/crates/ui/src/components/list/list_header.rs index d7a5c7bbaf4f58..91bb0ca76a2a23 100644 --- a/crates/ui/src/components/list/list_header.rs +++ b/crates/ui/src/components/list/list_header.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use std::sync::Arc; use crate::{h_flex, prelude::*, Disclosure, Label}; diff --git a/crates/ui/src/components/list/list_item.rs b/crates/ui/src/components/list/list_item.rs index 7eec79cfd74c46..2d2e506e62d4e3 100644 --- a/crates/ui/src/components/list/list_item.rs +++ b/crates/ui/src/components/list/list_item.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use std::sync::Arc; use gpui::{px, AnyElement, AnyView, ClickEvent, MouseButton, MouseDownEvent, Pixels}; diff --git a/crates/ui/src/components/list/list_separator.rs b/crates/ui/src/components/list/list_separator.rs index f3a900404f44b3..92a7c987c76f7d 100644 --- a/crates/ui/src/components/list/list_separator.rs +++ b/crates/ui/src/components/list/list_separator.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use crate::prelude::*; #[derive(IntoElement)] diff --git a/crates/ui/src/components/list/list_sub_header.rs b/crates/ui/src/components/list/list_sub_header.rs index 297068fc85b371..3cf2fd51d7d71c 100644 --- a/crates/ui/src/components/list/list_sub_header.rs +++ b/crates/ui/src/components/list/list_sub_header.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use crate::prelude::*; use crate::{h_flex, Icon, IconName, IconSize, Label}; diff --git a/crates/ui/src/components/modal.rs b/crates/ui/src/components/modal.rs index 601c4228c6ddac..b148e2902b2984 100644 --- a/crates/ui/src/components/modal.rs +++ b/crates/ui/src/components/modal.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use crate::{ h_flex, v_flex, Clickable, Color, DynamicSpacing, Headline, HeadlineSize, IconButton, IconButtonShape, IconName, Label, LabelCommon, LabelSize, diff --git a/crates/ui/src/components/numeric_stepper.rs b/crates/ui/src/components/numeric_stepper.rs index 87cdfbee645092..d491732b85a0f8 100644 --- a/crates/ui/src/components/numeric_stepper.rs +++ b/crates/ui/src/components/numeric_stepper.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::ClickEvent; use crate::{prelude::*, IconButtonShape}; diff --git a/crates/ui/src/components/popover.rs b/crates/ui/src/components/popover.rs index 85033eb32f10cc..2ac0b8f5fc9f6b 100644 --- a/crates/ui/src/components/popover.rs +++ b/crates/ui/src/components/popover.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use crate::prelude::*; use crate::v_flex; use gpui::{ diff --git a/crates/ui/src/components/popover_menu.rs b/crates/ui/src/components/popover_menu.rs index e3ce37b43e0b74..6be332b6932e1b 100644 --- a/crates/ui/src/components/popover_menu.rs +++ b/crates/ui/src/components/popover_menu.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use std::{cell::RefCell, rc::Rc}; use gpui::{ diff --git a/crates/ui/src/components/radio.rs b/crates/ui/src/components/radio.rs index d7ee106d2d5bb0..c7e19f5c34701e 100644 --- a/crates/ui/src/components/radio.rs +++ b/crates/ui/src/components/radio.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use std::sync::Arc; use crate::prelude::*; diff --git a/crates/ui/src/components/right_click_menu.rs b/crates/ui/src/components/right_click_menu.rs index 1bbf5aeedd292b..9d171e6daa26ee 100644 --- a/crates/ui/src/components/right_click_menu.rs +++ b/crates/ui/src/components/right_click_menu.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use std::{cell::RefCell, rc::Rc}; use gpui::{ diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index a9793adea81e23..5cb0b8a43dff1d 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use std::{any::Any, cell::Cell, fmt::Debug, ops::Range, rc::Rc, sync::Arc}; use crate::{prelude::*, px, relative, IntoElement}; diff --git a/crates/ui/src/components/settings_container.rs b/crates/ui/src/components/settings_container.rs index 538a5b91f849e3..b8a4a021c623fb 100644 --- a/crates/ui/src/components/settings_container.rs +++ b/crates/ui/src/components/settings_container.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::AnyElement; use smallvec::SmallVec; diff --git a/crates/ui/src/components/settings_group.rs b/crates/ui/src/components/settings_group.rs index 9ead450179096f..90cd1b16276ee1 100644 --- a/crates/ui/src/components/settings_group.rs +++ b/crates/ui/src/components/settings_group.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::AnyElement; use smallvec::SmallVec; diff --git a/crates/ui/src/components/stack.rs b/crates/ui/src/components/stack.rs index 2af0a5d3f98b08..74a5e80575bfe0 100644 --- a/crates/ui/src/components/stack.rs +++ b/crates/ui/src/components/stack.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::{div, Div}; use crate::StyledExt; diff --git a/crates/ui/src/components/stories.rs b/crates/ui/src/components/stories.rs index 9fa380c70319a8..e9e0649026c996 100644 --- a/crates/ui/src/components/stories.rs +++ b/crates/ui/src/components/stories.rs @@ -1,6 +1,5 @@ // We allow missing docs for stories as the docs will more or less be // "This is the ___ story", which is not very useful. -#![allow(missing_docs)] mod avatar; mod button; mod context_menu; diff --git a/crates/ui/src/components/tab.rs b/crates/ui/src/components/tab.rs index bf8637737753a2..3d16bdc84b3461 100644 --- a/crates/ui/src/components/tab.rs +++ b/crates/ui/src/components/tab.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use std::cmp::Ordering; use gpui::{AnyElement, IntoElement, Stateful}; diff --git a/crates/ui/src/components/tab_bar.rs b/crates/ui/src/components/tab_bar.rs index ee7b2a66446c88..cd6781be593cfc 100644 --- a/crates/ui/src/components/tab_bar.rs +++ b/crates/ui/src/components/tab_bar.rs @@ -1,4 +1,3 @@ -#![allow(missing_docs)] use gpui::{AnyElement, ScrollHandle}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/tooltip.rs b/crates/ui/src/components/tooltip.rs index cd391bb7f1a0ab..246b74cd2ee93e 100644 --- a/crates/ui/src/components/tooltip.rs +++ b/crates/ui/src/components/tooltip.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::{Action, AnyElement, AnyView, AppContext as _, FocusHandle, IntoElement, Render}; use settings::Settings; use theme::ThemeSettings; diff --git a/crates/ui/src/styles/typography.rs b/crates/ui/src/styles/typography.rs index c575e734756ac6..9848137441aab2 100644 --- a/crates/ui/src/styles/typography.rs +++ b/crates/ui/src/styles/typography.rs @@ -237,40 +237,37 @@ impl Headline { impl ComponentPreview for Headline { fn preview(_window: &mut Window, _cx: &App) -> AnyElement { v_flex() - .gap_6() - .children(vec![example_group_with_title( - "Headline Sizes", - vec![ - single_example( - "XLarge", - Headline::new("XLarge Headline") - .size(HeadlineSize::XLarge) - .into_any_element(), - ), - single_example( - "Large", - Headline::new("Large Headline") - .size(HeadlineSize::Large) - .into_any_element(), - ), - single_example( - "Medium (Default)", - Headline::new("Medium Headline").into_any_element(), - ), - single_example( - "Small", - Headline::new("Small Headline") - .size(HeadlineSize::Small) - .into_any_element(), - ), - single_example( - "XSmall", - Headline::new("XSmall Headline") - .size(HeadlineSize::XSmall) - .into_any_element(), - ), - ], - )]) + .gap_1() + .children(vec![ + single_example( + "XLarge", + Headline::new("XLarge Headline") + .size(HeadlineSize::XLarge) + .into_any_element(), + ), + single_example( + "Large", + Headline::new("Large Headline") + .size(HeadlineSize::Large) + .into_any_element(), + ), + single_example( + "Medium (Default)", + Headline::new("Medium Headline").into_any_element(), + ), + single_example( + "Small", + Headline::new("Small Headline") + .size(HeadlineSize::Small) + .into_any_element(), + ), + single_example( + "XSmall", + Headline::new("XSmall Headline") + .size(HeadlineSize::XSmall) + .into_any_element(), + ), + ]) .into_any_element() } } diff --git a/crates/ui/src/utils/format_distance.rs b/crates/ui/src/utils/format_distance.rs index af4f0d95052b28..213d9c8b4c2ef2 100644 --- a/crates/ui/src/utils/format_distance.rs +++ b/crates/ui/src/utils/format_distance.rs @@ -1,5 +1,4 @@ // This won't be documented further as it is intended to be removed, or merged with the `time_format` crate. -#![allow(missing_docs)] use chrono::{DateTime, Local, NaiveDateTime}; diff --git a/crates/ui/src/utils/search_input.rs b/crates/ui/src/utils/search_input.rs index 3a507f9a5ae145..c541a3b21fbf5b 100644 --- a/crates/ui/src/utils/search_input.rs +++ b/crates/ui/src/utils/search_input.rs @@ -1,5 +1,3 @@ -#![allow(missing_docs)] - use gpui::Pixels; pub struct SearchInputWidth;