diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rs index b179003901df54812888dd21d6248ec8f875bcbb..8c72491295d176e19edc9ec02fae5ceddb36a151 100644 --- a/crates/collab_ui2/src/collab_panel.rs +++ b/crates/collab_ui2/src/collab_panel.rs @@ -2484,7 +2484,7 @@ impl CollabPanel { | Section::Offline => true, }; - div() + h_stack() .w_full() .map(|el| { if can_collapse { diff --git a/crates/editor2/src/hover_popover.rs b/crates/editor2/src/hover_popover.rs index f80168ed250d3f3bdcbedb7ad1d61e9e173f15ef..2f2e8ee93732b0cb81fcf88775208519545b330d 100644 --- a/crates/editor2/src/hover_popover.rs +++ b/crates/editor2/src/hover_popover.rs @@ -15,7 +15,7 @@ use lsp::DiagnosticSeverity; use project::{HoverBlock, HoverBlockKind, InlayHintLabelPart, Project}; use settings::Settings; use std::{ops::Range, sync::Arc, time::Duration}; -use ui::Tooltip; +use ui::{StyledExt, Tooltip}; use util::TryFutureExt; use workspace::Workspace; @@ -476,8 +476,10 @@ impl InfoPopover { ) -> AnyElement { div() .id("info_popover") + .elevation_2(cx) + .text_ui() + .p_2() .overflow_y_scroll() - .bg(gpui::red()) .max_w(max_size.width) .max_h(max_size.height) // Prevent a mouse move on the popover from being propagated to the editor, diff --git a/crates/ui2/src/components.rs b/crates/ui2/src/components.rs index 0f46e3a37851878d0047a9f213a16faf54eb38ef..c5d06bf0dd181db3e75f67a4ecabe0d59a9288e9 100644 --- a/crates/ui2/src/components.rs +++ b/crates/ui2/src/components.rs @@ -11,7 +11,6 @@ mod keybinding; mod label; mod list; mod popover; -mod slot; mod stack; mod tooltip; @@ -31,7 +30,6 @@ pub use keybinding::*; pub use label::*; pub use list::*; pub use popover::*; -pub use slot::*; pub use stack::*; pub use tooltip::*; diff --git a/crates/ui2/src/components/disclosure.rs b/crates/ui2/src/components/disclosure.rs index b3736f36a004a2d63bc8613913ad8ae720e47df9..103c3112dfaa56bb6319735dc64beafd50222193 100644 --- a/crates/ui2/src/components/disclosure.rs +++ b/crates/ui2/src/components/disclosure.rs @@ -34,10 +34,9 @@ impl RenderOnce for Disclosure { fn render(self, _cx: &mut WindowContext) -> Self::Rendered { IconButton::new( "toggle", - if self.is_open { - Icon::ChevronDown - } else { - Icon::ChevronRight + match self.is_open { + true => Icon::ChevronDown, + false => Icon::ChevronRight, }, ) .color(Color::Muted) diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs index f5eb2eb44bf6ef2ff17a161af025cc503f331fe9..aafd04539149a703ab48e35fe8401f3b7db81f18 100644 --- a/crates/ui2/src/components/list.rs +++ b/crates/ui2/src/components/list.rs @@ -44,8 +44,8 @@ impl List { self } - pub fn toggle(mut self, toggle: Option) -> Self { - self.toggle = toggle; + pub fn toggle(mut self, toggle: impl Into>) -> Self { + self.toggle = toggle.into(); self } } diff --git a/crates/ui2/src/components/list/list_header.rs b/crates/ui2/src/components/list/list_header.rs index a205de62206939dc3954560b59c1aed0d86a4207..7eacaef920f9bf07afe7741d112186ee63837740 100644 --- a/crates/ui2/src/components/list/list_header.rs +++ b/crates/ui2/src/components/list/list_header.rs @@ -36,8 +36,8 @@ impl ListHeader { } } - pub fn toggle(mut self, toggle: Option) -> Self { - self.toggle = toggle; + pub fn toggle(mut self, toggle: impl Into>) -> Self { + self.toggle = toggle.into(); self } diff --git a/crates/ui2/src/components/list/list_item.rs b/crates/ui2/src/components/list/list_item.rs index f433255bef429cd99bfac38cc5efe10c242c29f7..7ad1d5fb72d5c739f4514ed8a6e0a250d3d399ef 100644 --- a/crates/ui2/src/components/list/list_item.rs +++ b/crates/ui2/src/components/list/list_item.rs @@ -70,8 +70,8 @@ impl ListItem { self } - pub fn toggle(mut self, toggle: Option) -> Self { - self.toggle = toggle; + pub fn toggle(mut self, toggle: impl Into>) -> Self { + self.toggle = toggle.into(); self } diff --git a/crates/ui2/src/components/slot.rs b/crates/ui2/src/slot.rs similarity index 89% rename from crates/ui2/src/components/slot.rs rename to crates/ui2/src/slot.rs index 7c896bf85b23d604a41aec259de125f06c059514..3438e34621753a38e1b755ceef6175819d2202e5 100644 --- a/crates/ui2/src/components/slot.rs +++ b/crates/ui2/src/slot.rs @@ -2,11 +2,9 @@ use gpui::{ImageSource, SharedString}; use crate::Icon; -#[derive(Debug, Clone)] /// A slot utility that provides a way to to pass either /// an icon or an image to a component. -/// -/// Can be filled with a [] +#[derive(Debug, Clone)] pub enum GraphicSlot { Icon(Icon), Avatar(ImageSource), diff --git a/crates/ui2/src/ui2.rs b/crates/ui2/src/ui2.rs index 6c5669741be05d2bdbf895d991c5e6a8f301e02f..7b054890a68183b3eebdd61b49f7accbcf7320c6 100644 --- a/crates/ui2/src/ui2.rs +++ b/crates/ui2/src/ui2.rs @@ -18,6 +18,7 @@ mod disableable; mod fixed; pub mod prelude; mod selectable; +mod slot; mod styled_ext; mod styles; pub mod utils; @@ -28,5 +29,6 @@ pub use disableable::*; pub use fixed::*; pub use prelude::*; pub use selectable::*; +pub use slot::*; pub use styled_ext::*; pub use styles::*;