Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into collab-titlebar-2

Piotr Osiewicz76366422a6f9
diff --cc crates/collab_ui/src/collab_titlebar_item.rs
index 87fd7470d6a,04fc9650eb8..80af71f06e0
--- a/crates/collab_ui/src/collab_titlebar_item.rs
+++ b/crates/collab_ui/src/collab_titlebar_item.rs
@@@ -496,17 -529,10 +509,17 @@@ impl CollabTitlebarItem
Stack::new()
.with_child(
MouseEventHandler::<ToggleUserMenu, Self>::new(0, cx, |state, _| {
- let style = titlebar.call_control.style_for(state, active);
+ let style = titlebar.call_control.style_for(state);
- Svg::new("icons/ellipsis_14.svg")
- .with_color(style.color)
- .constrained()
+
+ let img = if let Some(avatar_img) = avatar {
+ Self::render_face(avatar_img, *avatar_style, Color::transparent_black())
+ } else {
+ Svg::new("icons/ellipsis_14.svg")
+ .with_color(style.color)
+ .into_any()
+ };
+
+ img.constrained()
.with_width(style.icon_width)
.aligned()
.constrained()
diff --cc styles/src/styleTree/workspace.ts
index 15bcbcc27c3,bd14a3af727..d7f994d98ea
--- a/styles/src/styleTree/workspace.ts
+++ b/styles/src/styleTree/workspace.ts
@@@ -15,60 -17,47 +17,83 @@@ export default function workspace(color
const layer = colorScheme.lowest
const isLight = colorScheme.isLight
const itemSpacing = 8
- const titlebarButton = {
- cornerRadius: 6,
- padding: {
- top: 1,
- bottom: 1,
- left: 8,
- right: 8,
- },
- ...text(layer, "sans", "variant", { size: "xs" }),
- background: background(layer, "variant"),
- border: border(layer),
- hover: {
- ...text(layer, "sans", "variant", "hovered", { size: "xs" }),
- background: background(layer, "variant", "hovered"),
- border: border(layer, "variant", "hovered"),
- },
- clicked: {
- ...text(layer, "sans", "variant", "pressed", { size: "xs" }),
- background: background(layer, "variant", "pressed"),
- border: border(layer, "variant", "pressed"),
- },
- active: {
- ...text(layer, "sans", "variant", "active", { size: "xs" }),
- background: background(layer, "variant", "active"),
- border: border(layer, "variant", "active"),
- },
- }
- const signInButton = {
- cornerRadius: 6,
- padding: {
- top: 1,
- bottom: 1,
- left: 8,
- right: 8,
- },
- ...text(layer, "sans", "variant", { size: "xs" }),
- background: background(layer, "variant"),
- //border: border(layer),
- hover: {
- ...text(layer, "sans", "variant", "hovered", { size: "xs" }),
- background: background(layer, "variant", "hovered"),
- //border: border(layer, "variant", "hovered"),
- },
- clicked: {
- ...text(layer, "sans", "variant", "pressed", { size: "xs" }),
- background: background(layer, "variant", "pressed"),
- //border: border(layer, "variant", "pressed"),
- },
- active: {
- ...text(layer, "sans", "variant", "active", { size: "xs" }),
- background: background(layer, "variant", "active"),
- //border: border(layer, "variant", "active"),
- },
- }
+ const titlebarButton = toggleable({
+ base: interactive({
+ base: {
+ cornerRadius: 6,
+ padding: {
+ top: 1,
+ bottom: 1,
+ left: 8,
+ right: 8,
+ },
+ ...text(layer, "sans", "variant", { size: "xs" }),
+ background: background(layer, "variant"),
+ border: border(layer),
+ },
+ state: {
+ hovered: {
+ ...text(layer, "sans", "variant", "hovered", {
+ size: "xs",
+ }),
+ background: background(layer, "variant", "hovered"),
+ border: border(layer, "variant", "hovered"),
+ },
+ clicked: {
+ ...text(layer, "sans", "variant", "pressed", {
+ size: "xs",
+ }),
+ background: background(layer, "variant", "pressed"),
+ border: border(layer, "variant", "pressed"),
+ },
+ },
+ }),
+ state: {
+ active: {
+ default: {
+ ...text(layer, "sans", "variant", "active", { size: "xs" }),
+ background: background(layer, "variant", "active"),
+ border: border(layer, "variant", "active"),
+ },
+ },
- },
- })
++ }
++ });
++ const signInButton = toggleable({
++ base: interactive({
++ base: {
++ cornerRadius: 6,
++ padding: {
++ top: 1,
++ bottom: 1,
++ left: 8,
++ right: 8,
++ },
++ ...text(layer, "sans", "variant", { size: "xs" }),
++ background: background(layer, "variant"),
++ },
++ state: {
++ hovered: {
++ ...text(layer, "sans", "variant", "hovered", { size: "xs" }),
++ background: background(layer, "variant", "hovered"),
++ //border: border(layer, "variant", "hovered"),
++ },
++ clicked: {
++ ...text(layer, "sans", "variant", "pressed", { size: "xs" }),
++ background: background(layer, "variant", "pressed"),
++ //border: border(layer, "variant", "pressed"),
++ }
++ }
++ }),
++ state: {
++ active: {
++ default: {
++ ...text(layer, "sans", "variant", "active", { size: "xs" }),
++ background: background(layer, "variant", "active"),
++ //border: border(layer, "variant", "active"),
++ }
++ },
++ }
++ });
const avatarWidth = 18
const avatarOuterWidth = avatarWidth + 4
const followerAvatarWidth = 14
@@@ -228,12 -222,15 +258,18 @@@
// Sign in buttom
// FlatButton, Variant
- signInPrompt: {
- margin: {
- left: itemSpacing,
+ signInPrompt: merge(titlebarButton, {
+ inactive: {
+ default: {
+ margin: {
+ left: itemSpacing,
+ },
+ },
},
- ...signInButton,
- },
++
++ signInButton,
++
+ }),
// Offline Indicator
offlineIcon: {
@@@ -261,44 -258,68 +297,69 @@@
},
cornerRadius: 6,
},
- callControl: {
- cornerRadius: 6,
- color: foreground(layer, "variant"),
- iconWidth: 12,
- buttonWidth: 20,
- hover: {
- background: background(layer, "variant", "hovered"),
- color: foreground(layer, "variant", "hovered"),
+ callControl: interactive({
+ base: {
+ cornerRadius: 6,
+ color: foreground(layer, "variant"),
+ iconWidth: 12,
+ buttonWidth: 20,
},
- active: {
- background: background(layer, "variant", "active"),
- color: foreground(layer, "variant", "active"),
+ state: {
+ hovered: {
+ background: background(layer, "variant", "hovered"),
+ color: foreground(layer, "variant", "hovered"),
+ },
},
- },
- toggleContactsButton: {
- margin: { left: itemSpacing },
- cornerRadius: 6,
- color: foreground(layer, "variant"),
- iconWidth: 14,
- buttonWidth: 20,
- active: {
- background: background(layer, "variant", "active"),
- color: foreground(layer, "variant", "active"),
+ }),
+ toggleContactsButton: toggleable({
+ base: interactive({
+ base: {
+ margin: { left: itemSpacing },
+ cornerRadius: 6,
+ color: foreground(layer, "variant"),
+ iconWidth: 14,
+ buttonWidth: 20,
+ },
+ state: {
+ clicked: {
+ background: background(layer, "variant", "pressed"),
+ },
+ hovered: {
+ background: background(layer, "variant", "hovered"),
+ },
+ },
+ }),
+ state: {
+ active: {
+ default: {
+ background: background(layer, "on", "default"),
+ },
+ hovered: {
+ background: background(layer, "on", "hovered"),
+ },
+ clicked: {
+ background: background(layer, "on", "pressed"),
+ },
+ },
},
- clicked: {
- background: background(layer, "variant", "pressed"),
- color: foreground(layer, "variant", "pressed"),
+ }),
+ userMenuButton: merge(titlebarButton, {
+ inactive: {
+ default: {
+ buttonWidth: 20,
+ iconWidth: 12,
+ },
},
- hover: {
- background: background(layer, "variant", "hovered"),
- color: foreground(layer, "variant", "hovered"),
+ active: {
- // posiewic: these properties are not currently set on main
+ default: {
+ iconWidth: 12,
+ button_width: 20,
- },
++ background: background(layer, "variant", "active"),
++ color: foreground(layer, "variant", "active"),
++ }
},
- },
- userMenuButton: {
- buttonWidth: 20,
- iconWidth: 12,
- ...titlebarButton,
- },
+ }),
+
toggleContactsBadge: {
cornerRadius: 3,
padding: 2,