collab: Tweak screen selector appearance (#34919)

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>


Release Notes:

- N/A

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
Piotr Osiewicz 2025-07-22 20:53:57 +02:00 committed by GitHub
parent 4272c1508e
commit 708c2645d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 19 deletions

View file

@ -501,7 +501,7 @@ mod remote_button {
) )
.into_any_element(); .into_any_element();
SplitButton { left, right } SplitButton::new(left, right)
} }
} }

View file

@ -11,8 +11,8 @@ use gpui::{App, Task, Window, actions};
use rpc::proto::{self}; use rpc::proto::{self};
use theme::ActiveTheme; use theme::ActiveTheme;
use ui::{ use ui::{
Avatar, AvatarAudioStatusIndicator, ContextMenu, ContextMenuItem, Facepile, PopoverMenu, Avatar, AvatarAudioStatusIndicator, ContextMenu, ContextMenuItem, Divider, Facepile,
SplitButton, TintColor, Tooltip, prelude::*, PopoverMenu, SplitButton, SplitButtonStyle, TintColor, Tooltip, prelude::*,
}; };
use util::maybe; use util::maybe;
use workspace::notifications::DetachAndPromptErr; use workspace::notifications::DetachAndPromptErr;
@ -383,6 +383,7 @@ impl TitleBar {
.detach_and_log_err(cx); .detach_and_log_err(cx);
}), }),
) )
.child(Divider::vertical())
.into_any_element(), .into_any_element(),
); );
@ -497,6 +498,7 @@ impl TitleBar {
trigger.render(window, cx), trigger.render(window, cx),
self.render_screen_list().into_any_element(), self.render_screen_list().into_any_element(),
) )
.style(SplitButtonStyle::Outlined)
.into_any_element(), .into_any_element(),
); );
} }
@ -547,10 +549,17 @@ impl TitleBar {
entry_render: Box::new(move |_, _| { entry_render: Box::new(move |_, _| {
h_flex() h_flex()
.gap_2() .gap_2()
.child(Icon::new(IconName::Screen).when( .child(
active_screenshare_id == Some(meta.id), Icon::new(IconName::Screen)
|this| this.color(Color::Accent), .size(IconSize::XSmall)
)) .map(|this| {
if active_screenshare_id == Some(meta.id) {
this.color(Color::Accent)
} else {
this.color(Color::Muted)
}
}),
)
.child(Label::new(label.clone())) .child(Label::new(label.clone()))
.child( .child(
Label::new(resolution.clone()) Label::new(resolution.clone())

View file

@ -1,6 +1,6 @@
use gpui::{ use gpui::{
AnyElement, App, BoxShadow, IntoElement, ParentElement, RenderOnce, Styled, Window, div, hsla, AnyElement, App, BoxShadow, IntoElement, ParentElement, RenderOnce, Styled, Window, div, hsla,
point, px, point, prelude::FluentBuilder, px,
}; };
use theme::ActiveTheme; use theme::ActiveTheme;
@ -8,6 +8,12 @@ use crate::{ElevationIndex, h_flex};
use super::ButtonLike; use super::ButtonLike;
#[derive(Clone, Copy, PartialEq)]
pub enum SplitButtonStyle {
Filled,
Outlined,
}
/// /// A button with two parts: a primary action on the left and a secondary action on the right. /// /// A button with two parts: a primary action on the left and a secondary action on the right.
/// ///
/// The left side is a [`ButtonLike`] with the main action, while the right side can contain /// The left side is a [`ButtonLike`] with the main action, while the right side can contain
@ -18,11 +24,21 @@ use super::ButtonLike;
pub struct SplitButton { pub struct SplitButton {
pub left: ButtonLike, pub left: ButtonLike,
pub right: AnyElement, pub right: AnyElement,
style: SplitButtonStyle,
} }
impl SplitButton { impl SplitButton {
pub fn new(left: ButtonLike, right: AnyElement) -> Self { pub fn new(left: ButtonLike, right: AnyElement) -> Self {
Self { left, right } Self {
left,
right,
style: SplitButtonStyle::Filled,
}
}
pub fn style(mut self, style: SplitButtonStyle) -> Self {
self.style = style;
self
} }
} }
@ -31,21 +47,23 @@ impl RenderOnce for SplitButton {
h_flex() h_flex()
.rounded_sm() .rounded_sm()
.border_1() .border_1()
.border_color(cx.theme().colors().text_muted.alpha(0.12)) .border_color(cx.theme().colors().border.opacity(0.5))
.child(div().flex_grow().child(self.left)) .child(div().flex_grow().child(self.left))
.child( .child(
div() div()
.h_full() .h_full()
.w_px() .w_px()
.bg(cx.theme().colors().text_muted.alpha(0.16)), .bg(cx.theme().colors().border.opacity(0.5)),
) )
.child(self.right) .child(self.right)
.bg(ElevationIndex::Surface.on_elevation_bg(cx)) .when(self.style == SplitButtonStyle::Filled, |this| {
.shadow(vec![BoxShadow { this.bg(ElevationIndex::Surface.on_elevation_bg(cx))
color: hsla(0.0, 0.0, 0.0, 0.16), .shadow(vec![BoxShadow {
offset: point(px(0.), px(1.)), color: hsla(0.0, 0.0, 0.0, 0.16),
blur_radius: px(0.), offset: point(px(0.), px(1.)),
spread_radius: px(0.), blur_radius: px(0.),
}]) spread_radius: px(0.),
}])
})
} }
} }

View file

@ -84,7 +84,9 @@ impl RenderOnce for List {
(false, _) => this.children(self.children), (false, _) => this.children(self.children),
(true, Some(false)) => this, (true, Some(false)) => this,
(true, _) => match self.empty_message { (true, _) => match self.empty_message {
EmptyMessage::Text(text) => this.child(Label::new(text).color(Color::Muted)), EmptyMessage::Text(text) => {
this.px_2().child(Label::new(text).color(Color::Muted))
}
EmptyMessage::Element(element) => this.child(element), EmptyMessage::Element(element) => this.child(element),
}, },
}) })