Use icon_button for leave call

This commit is contained in:
Nate Butler
2023-06-27 11:34:12 -04:00
parent 3104275d87
commit 331800c14d
5 changed files with 65 additions and 21 deletions
+54
View File
@@ -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"),
},
},
});
}