Update screenshare toggle, titlebar spacing

This commit is contained in:
Nate Butler 2023-06-27 16:20:45 -04:00
parent 60ce584427
commit 825a7cb799
5 changed files with 47 additions and 19 deletions

View File

@ -408,16 +408,21 @@ impl CollabTitlebarItem {
let icon; let icon;
let tooltip; let tooltip;
if room.read(cx).is_screen_sharing() { if room.read(cx).is_screen_sharing() {
icon = "icons/radix/desktop-mute.svg"; icon = "icons/radix/desktop.svg";
tooltip = "Stop Sharing Screen" tooltip = "Stop Sharing Screen"
} else { } else {
icon = "icons/radix/desktop.svg"; icon = "icons/radix/desktop.svg";
tooltip = "Share Screen"; tooltip = "Share Screen";
} }
let active = room.read(cx).is_screen_sharing();
let titlebar = &theme.workspace.titlebar; let titlebar = &theme.workspace.titlebar;
MouseEventHandler::<ToggleScreenSharing, Self>::new(0, cx, |state, _| { MouseEventHandler::<ToggleScreenSharing, Self>::new(0, cx, |state, _| {
let style = titlebar.screen_share_button.style_for(state); let style = titlebar
.screen_share_button
.in_state(active)
.style_for(state);
Svg::new(icon) Svg::new(icon)
.with_color(style.color) .with_color(style.color)
.constrained() .constrained()
@ -701,7 +706,7 @@ impl CollabTitlebarItem {
fn render_sign_in_button(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> AnyElement<Self> { fn render_sign_in_button(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
let titlebar = &theme.workspace.titlebar; let titlebar = &theme.workspace.titlebar;
MouseEventHandler::<SignIn, Self>::new(0, cx, |state, _| { MouseEventHandler::<SignIn, Self>::new(0, cx, |state, _| {
let style = titlebar.sign_in_prompt.inactive_state().style_for(state); let style = titlebar.sign_in_button.inactive_state().style_for(state);
Label::new("Sign In", style.text.clone()) Label::new("Sign In", style.text.clone())
.contained() .contained()
.with_style(style.container) .with_style(style.container)

View File

@ -130,7 +130,7 @@ pub struct Titlebar {
pub leader_avatar: AvatarStyle, pub leader_avatar: AvatarStyle,
pub follower_avatar: AvatarStyle, pub follower_avatar: AvatarStyle,
pub inactive_avatar_grayscale: bool, pub inactive_avatar_grayscale: bool,
pub sign_in_prompt: Toggleable<Interactive<ContainedText>>, pub sign_in_button: Toggleable<Interactive<ContainedText>>,
pub outdated_warning: ContainedText, pub outdated_warning: ContainedText,
pub share_button: Toggleable<Interactive<ContainedText>>, pub share_button: Toggleable<Interactive<ContainedText>>,
pub screen_share_button: Toggleable<Interactive<IconButton>>, pub screen_share_button: Toggleable<Interactive<IconButton>>,

View File

@ -1,7 +1,13 @@
import { ColorScheme } from "../common"; import { ColorScheme } from "../common";
import { interactive, toggleable } from "../element"; import { interactive, toggleable } from "../element";
import { background, foreground } from "../styleTree/components"; import { background, foreground } from "../styleTree/components";
import { Margin } from "../types/zed";
export type Margin = {
top: number;
bottom: number;
left: number;
right: number;
}
interface IconButtonOptions { interface IconButtonOptions {
layer?: ColorScheme['lowest'] | ColorScheme['middle'] | ColorScheme['highest']; layer?: ColorScheme['lowest'] | ColorScheme['middle'] | ColorScheme['highest'];
@ -34,8 +40,8 @@ export function icon_button(theme: ColorScheme, { color, margin, layer }: IconBu
margin: m, margin: m,
icon_width: 15, icon_width: 15,
icon_height: 15, icon_height: 15,
button_width: 23, button_width: 21,
button_height: 19, button_height: 17,
}, },
state: { state: {
default: { default: {

View File

@ -1,7 +1,7 @@
import { ColorScheme } from "../common"; import { ColorScheme } from "../common";
import { interactive, toggleable } from "../element"; import { interactive, toggleable } from "../element";
import { TextProperties, background, foreground, text } from "../styleTree/components"; import { TextProperties, background, foreground, text } from "../styleTree/components";
import { Margin } from "../types/zed"; import { Margin } from "./icon_button";
interface TextButtonOptions { interface TextButtonOptions {
layer?: ColorScheme['lowest'] | ColorScheme['middle'] | ColorScheme['highest']; layer?: ColorScheme['lowest'] | ColorScheme['middle'] | ColorScheme['highest'];

View File

@ -260,7 +260,7 @@ export default function workspace(colorScheme: ColorScheme) {
// Sign in buttom // Sign in buttom
// FlatButton, Variant // FlatButton, Variant
signInPrompt: merge(titlebarButton, { sign_in_button: merge(titlebarButton, {
inactive: { inactive: {
default: { default: {
margin: { margin: {
@ -300,25 +300,41 @@ export default function workspace(colorScheme: ColorScheme) {
cornerRadius: 6, cornerRadius: 6,
}, },
screen_share_button: icon_button(colorScheme, { leave_call_button: icon_button(colorScheme, {
margin: { left: itemSpacing / 2 }, margin: {
}), left: itemSpacing / 2,
right: itemSpacing
toggle_contacts_button: toggleable_icon_button(colorScheme, { },
margin: { left: itemSpacing }
}), }),
toggle_microphone_button: toggleable_icon_button(colorScheme, { toggle_microphone_button: toggleable_icon_button(colorScheme, {
margin: { left: itemSpacing }, margin: {
left: itemSpacing,
right: itemSpacing / 2
},
active_color: 'negative' active_color: 'negative'
}), }),
toggle_speakers_button: toggleable_icon_button(colorScheme, { toggle_speakers_button: toggleable_icon_button(colorScheme, {
margin: { left: itemSpacing / 2 }, margin: {
left: itemSpacing / 2,
right: itemSpacing / 2
},
}), }),
leave_call_button: icon_button(colorScheme, { screen_share_button: toggleable_icon_button(colorScheme, {
margin: { left: itemSpacing }, margin: {
left: itemSpacing / 2,
right: itemSpacing
},
active_color: 'accent'
}),
toggle_contacts_button: toggleable_icon_button(colorScheme, {
margin: {
left: itemSpacing,
right: itemSpacing / 2
},
}), }),
user_menu_button: user_menu_button:
@ -339,6 +355,7 @@ export default function workspace(colorScheme: ColorScheme) {
}, },
}), }),
// Jewel that notifies you that there are new contact requests
toggleContactsBadge: { toggleContactsBadge: {
cornerRadius: 3, cornerRadius: 3,
padding: 2, padding: 2,