Update collab button styles
This commit is contained in:
parent
92d2048aa4
commit
82b3efa16c
2 changed files with 75 additions and 62 deletions
|
@ -239,54 +239,74 @@ impl Render for CollabTitlebarItem {
|
||||||
.when(is_in_room, |this| {
|
.when(is_in_room, |this| {
|
||||||
this.child(
|
this.child(
|
||||||
h_stack()
|
h_stack()
|
||||||
|
.gap_1()
|
||||||
.child(
|
.child(
|
||||||
h_stack()
|
h_stack()
|
||||||
.child(Button::new(
|
.gap_1()
|
||||||
"toggle_sharing",
|
.child(
|
||||||
if is_shared { "Unshare" } else { "Share" },
|
Button::new(
|
||||||
))
|
"toggle_sharing",
|
||||||
.child(IconButton::new("leave-call", ui::Icon::Exit).on_click({
|
if is_shared { "Unshare" } else { "Share" },
|
||||||
let workspace = workspace.clone();
|
)
|
||||||
move |_, cx| {
|
.style(ButtonStyle2::Subtle),
|
||||||
workspace
|
)
|
||||||
.update(cx, |this, cx| {
|
.child(
|
||||||
this.call_state().hang_up(cx).detach();
|
IconButton::new("leave-call", ui::Icon::Exit)
|
||||||
})
|
.style(ButtonStyle2::Subtle)
|
||||||
.log_err();
|
.on_click({
|
||||||
}
|
let workspace = workspace.clone();
|
||||||
})),
|
move |_, cx| {
|
||||||
|
workspace
|
||||||
|
.update(cx, |this, cx| {
|
||||||
|
this.call_state().hang_up(cx).detach();
|
||||||
|
})
|
||||||
|
.log_err();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
h_stack()
|
h_stack()
|
||||||
.child(IconButton::new("mute-microphone", mic_icon).on_click({
|
.gap_1()
|
||||||
let workspace = workspace.clone();
|
.child(
|
||||||
move |_, cx| {
|
IconButton::new("mute-microphone", mic_icon)
|
||||||
workspace
|
.style(ButtonStyle2::Subtle)
|
||||||
.update(cx, |this, cx| {
|
.on_click({
|
||||||
this.call_state().toggle_mute(cx);
|
let workspace = workspace.clone();
|
||||||
})
|
move |_, cx| {
|
||||||
.log_err();
|
workspace
|
||||||
}
|
.update(cx, |this, cx| {
|
||||||
}))
|
this.call_state().toggle_mute(cx);
|
||||||
.child(IconButton::new("mute-sound", speakers_icon).on_click({
|
})
|
||||||
let workspace = workspace.clone();
|
.log_err();
|
||||||
move |_, cx| {
|
}
|
||||||
workspace
|
}),
|
||||||
.update(cx, |this, cx| {
|
)
|
||||||
this.call_state().toggle_deafen(cx);
|
.child(
|
||||||
})
|
IconButton::new("mute-sound", speakers_icon)
|
||||||
.log_err();
|
.style(ButtonStyle2::Subtle)
|
||||||
}
|
.on_click({
|
||||||
}))
|
let workspace = workspace.clone();
|
||||||
.child(IconButton::new("screen-share", ui::Icon::Screen).on_click(
|
move |_, cx| {
|
||||||
move |_, cx| {
|
workspace
|
||||||
workspace
|
.update(cx, |this, cx| {
|
||||||
.update(cx, |this, cx| {
|
this.call_state().toggle_deafen(cx);
|
||||||
this.call_state().toggle_screen_share(cx);
|
})
|
||||||
})
|
.log_err();
|
||||||
.log_err();
|
}
|
||||||
},
|
}),
|
||||||
))
|
)
|
||||||
|
.child(
|
||||||
|
IconButton::new("screen-share", ui::Icon::Screen)
|
||||||
|
.style(ButtonStyle2::Subtle)
|
||||||
|
.on_click(move |_, cx| {
|
||||||
|
workspace
|
||||||
|
.update(cx, |this, cx| {
|
||||||
|
this.call_state().toggle_screen_share(cx);
|
||||||
|
})
|
||||||
|
.log_err();
|
||||||
|
}),
|
||||||
|
)
|
||||||
.pl_2(),
|
.pl_2(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -295,20 +315,14 @@ impl Render for CollabTitlebarItem {
|
||||||
if let Some(user) = current_user {
|
if let Some(user) = current_user {
|
||||||
this.when_some(user.avatar.clone(), |this, avatar| {
|
this.when_some(user.avatar.clone(), |this, avatar| {
|
||||||
this.child(
|
this.child(
|
||||||
PopoverMenu::new(
|
ButtonLike::new("user-menu")
|
||||||
ButtonLike::new("user-menu")
|
.child(
|
||||||
.child(h_stack().gap_0p5().child(Avatar::data(avatar)).child(
|
h_stack().gap_0p5().child(Avatar::data(avatar)).child(
|
||||||
IconElement::new(Icon::ChevronDown).color(Color::Muted),
|
IconElement::new(Icon::ChevronDown).color(Color::Muted),
|
||||||
))
|
),
|
||||||
.style(ButtonStyle2::Subtle)
|
)
|
||||||
.tooltip(move |cx| Tooltip::text("Toggle User Menu", cx))
|
.style(ButtonStyle2::Subtle)
|
||||||
.into_any_element(),
|
.tooltip(move |cx| Tooltip::text("Toggle User Menu", cx)),
|
||||||
)
|
|
||||||
.children(vec![
|
|
||||||
ListItem::new("foo"),
|
|
||||||
ListItem::new("bar"),
|
|
||||||
ListItem::new("baz"),
|
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use gpui::{
|
use gpui::{div, overlay, AnyElement, Div, ParentElement, RenderOnce, Styled, WindowContext};
|
||||||
div, overlay, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce,
|
|
||||||
Styled, WindowContext,
|
|
||||||
};
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
use crate::{prelude::*, ElevationIndex, List, Popover};
|
use crate::{prelude::*, Popover};
|
||||||
|
|
||||||
|
// 🚧 Under Construction
|
||||||
|
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
pub struct PopoverMenu {
|
pub struct PopoverMenu {
|
||||||
|
@ -15,7 +14,7 @@ pub struct PopoverMenu {
|
||||||
impl RenderOnce for PopoverMenu {
|
impl RenderOnce for PopoverMenu {
|
||||||
type Rendered = Div;
|
type Rendered = Div;
|
||||||
|
|
||||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||||
div()
|
div()
|
||||||
.relative()
|
.relative()
|
||||||
.child(self.trigger)
|
.child(self.trigger)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue