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.

Use `icon_button` for leave call

Nate Butler331800c14d17
diff --git a/styles/src/component/icon_button.ts b/styles/src/component/icon_button.ts
new file mode 100644
index 00000000000..d71996042b1
--- /dev/null
+++ b/styles/src/component/icon_button.ts
@@ -0,0 +1,54 @@
+import { ColorScheme } from "../common";
+import { interactive } from "../element";
+import { background, foreground } from "../styleTree/components";
+import { Margin } from "../types/zed";
+
+interface IconButtonOptions {
+ color?: keyof ColorScheme['lowest'];
+ margin?: Partial<Margin>;
+}
+
+export function icon_button(theme: ColorScheme, { color, margin }: IconButtonOptions) {
+ if (!color)
+ color = "base";
+
+ const m = {
+ top: margin?.top ?? 0,
+ bottom: margin?.bottom ?? 0,
+ left: margin?.left ?? 0,
+ right: margin?.right ?? 0,
+ }
+
+ return interactive({
+ base: {
+ corner_radius: 4,
+ padding: {
+ top: 2,
+ bottom: 2,
+ left: 4,
+ right: 4,
+ },
+ margin: m,
+ icon_width: 15,
+ icon_height: 15,
+ button_width: 23,
+ button_height: 19,
+ },
+ state: {
+ default: {
+ background: background(theme.lowest, color),
+ color: foreground(theme.lowest, color),
+ },
+ hovered: {
+ background: background(theme.lowest, color, "hovered"),
+ color: foreground(theme.lowest, color, "hovered"),
+
+ },
+ clicked: {
+ background: background(theme.lowest, color, "pressed"),
+ color: foreground(theme.lowest, color, "pressed"),
+
+ },
+ },
+ });
+}
diff --git a/styles/src/element/index.ts b/styles/src/element/index.ts
index b1e3cfe415f..81c911c7bd6 100644
--- a/styles/src/element/index.ts
+++ b/styles/src/element/index.ts
@@ -1,4 +1,4 @@
-import { interactive } from "./interactive"
+import { interactive, Interactive } from "./interactive"
import { toggleable } from "./toggle"
-export { interactive, toggleable }
+export { interactive, Interactive, toggleable }
diff --git a/styles/src/element/interactive.ts b/styles/src/element/interactive.ts
index 1c0f393cff5..79fee70cb93 100644
--- a/styles/src/element/interactive.ts
+++ b/styles/src/element/interactive.ts
@@ -8,7 +8,7 @@ type InteractiveState =
| "selected"
| "disabled"
-type Interactive<T> = {
+export type Interactive<T> = {
default: T
hovered?: T
clicked?: T
diff --git a/styles/src/styleTree/titlebar.ts b/styles/src/styleTree/titlebar.ts
index 4c2c2147f84..3aa41359fa1 100644
--- a/styles/src/styleTree/titlebar.ts
+++ b/styles/src/styleTree/titlebar.ts
@@ -58,11 +58,13 @@ const titlebarButton = (theme: ColorScheme) => toggleable({
*/
function userMenuButton(theme: ColorScheme) {
return {
- userMenu: titlebarButton(theme),
+ user_menu: titlebarButton(theme),
avatar: {
icon_width: 16,
icon_height: 16,
cornerRadius: 4,
+ outer_corner_radius: 0,
+ outer_width: 0,
outerWidth: 10,
outerCornerRadius: 10
},
diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts
index abc237468a1..a500988bf71 100644
--- a/styles/src/styleTree/workspace.ts
+++ b/styles/src/styleTree/workspace.ts
@@ -13,6 +13,7 @@ import statusBar from "./statusBar"
import tabBar from "./tabBar"
import { interactive } from "../element"
import merge from "ts-deepmerge"
+import { icon_button } from "../component/icon_button"
export default function workspace(colorScheme: ColorScheme) {
const layer = colorScheme.lowest
const isLight = colorScheme.isLight
@@ -252,7 +253,7 @@ export default function workspace(colorScheme: ColorScheme) {
},
avatarRibbon: {
height: 3,
- width: 12,
+ width: 11,
// TODO: Chore: Make avatarRibbon colors driven by the theme rather than being hard coded.
},
@@ -407,22 +408,9 @@ export default function workspace(colorScheme: ColorScheme) {
},
},
}),
- leaveCallButton: 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"),
- },
- },
+
+ leaveCallButton: icon_button(colorScheme, {
+ margin: { left: itemSpacing },
}),
userMenuButton: merge(titlebarButton, {