Style the clear button better, add border to button constructor options
This commit is contained in:
parent
7b5974e8e9
commit
fe2300fdaa
4 changed files with 25 additions and 5 deletions
|
@ -583,6 +583,7 @@ impl View for LspLogToolbarItemView {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let server_selected = current_server.is_some();
|
||||||
|
|
||||||
enum Menu {}
|
enum Menu {}
|
||||||
let lsp_menu = Stack::new()
|
let lsp_menu = Stack::new()
|
||||||
|
@ -642,12 +643,14 @@ impl View for LspLogToolbarItemView {
|
||||||
.workspace
|
.workspace
|
||||||
.toolbar
|
.toolbar
|
||||||
.toggleable_text_tool
|
.toggleable_text_tool
|
||||||
.active_state()
|
.in_state(server_selected)
|
||||||
.style_for(state);
|
.style_for(state);
|
||||||
Label::new("Clear", style.text.clone())
|
Label::new("Clear", style.text.clone())
|
||||||
.aligned()
|
.aligned()
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(style.container)
|
.with_style(style.container)
|
||||||
|
.constrained()
|
||||||
|
.with_height(theme.toolbar_dropdown_menu.row_height / 6.0 * 5.0)
|
||||||
})
|
})
|
||||||
.on_click(MouseButton::Left, move |_, this, cx| {
|
.on_click(MouseButton::Left, move |_, this, cx| {
|
||||||
if let Some(log_view) = this.log_view.as_ref() {
|
if let Some(log_view) = this.log_view.as_ref() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { interactive, toggleable } from "../element"
|
import { interactive, toggleable } from "../element"
|
||||||
import {
|
import {
|
||||||
|
Border,
|
||||||
TextProperties,
|
TextProperties,
|
||||||
background,
|
background,
|
||||||
foreground,
|
foreground,
|
||||||
|
@ -16,6 +17,7 @@ interface TextButtonOptions {
|
||||||
margin?: Partial<Margin>
|
margin?: Partial<Margin>
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
text_properties?: TextProperties
|
text_properties?: TextProperties
|
||||||
|
border?: Border
|
||||||
}
|
}
|
||||||
|
|
||||||
type ToggleableTextButtonOptions = TextButtonOptions & {
|
type ToggleableTextButtonOptions = TextButtonOptions & {
|
||||||
|
@ -29,6 +31,7 @@ export function text_button({
|
||||||
margin,
|
margin,
|
||||||
disabled,
|
disabled,
|
||||||
text_properties,
|
text_properties,
|
||||||
|
border,
|
||||||
}: TextButtonOptions = {}) {
|
}: TextButtonOptions = {}) {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
if (!color) color = "base"
|
if (!color) color = "base"
|
||||||
|
@ -66,6 +69,7 @@ export function text_button({
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
default: {
|
default: {
|
||||||
|
border,
|
||||||
background: background_color,
|
background: background_color,
|
||||||
color: disabled
|
color: disabled
|
||||||
? foreground(layer ?? theme.lowest, "disabled")
|
? foreground(layer ?? theme.lowest, "disabled")
|
||||||
|
@ -74,6 +78,7 @@ export function text_button({
|
||||||
hovered: disabled
|
hovered: disabled
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
|
border,
|
||||||
background: background(
|
background: background(
|
||||||
layer ?? theme.lowest,
|
layer ?? theme.lowest,
|
||||||
color,
|
color,
|
||||||
|
@ -88,6 +93,7 @@ export function text_button({
|
||||||
clicked: disabled
|
clicked: disabled
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
|
border,
|
||||||
background: background(
|
background: background(
|
||||||
layer ?? theme.lowest,
|
layer ?? theme.lowest,
|
||||||
color,
|
color,
|
||||||
|
|
|
@ -37,8 +37,21 @@ export const toolbar = () => {
|
||||||
}),
|
}),
|
||||||
toggleable_text_tool: toggleable({
|
toggleable_text_tool: toggleable({
|
||||||
state: {
|
state: {
|
||||||
inactive: text_button({ variant: "ghost", layer: theme.highest, disabled: true, margin: { right: 4 }, text_properties: { size: "sm" } }),
|
inactive: text_button({
|
||||||
active: text_button({ variant: "ghost", layer: theme.highest, margin: { right: 4 }, text_properties: { size: "sm" } })
|
disabled: true,
|
||||||
|
variant: "ghost",
|
||||||
|
layer: theme.highest,
|
||||||
|
margin: { left: 4 },
|
||||||
|
text_properties: { size: "sm" },
|
||||||
|
border: border(theme.middle),
|
||||||
|
}),
|
||||||
|
active: text_button({
|
||||||
|
variant: "ghost",
|
||||||
|
layer: theme.highest,
|
||||||
|
margin: { left: 4 },
|
||||||
|
text_properties: { size: "sm" },
|
||||||
|
border: border(theme.middle),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@ export default function workspace(): any {
|
||||||
|
|
||||||
const { is_light } = theme
|
const { is_light } = theme
|
||||||
|
|
||||||
const TOOLBAR_ITEM_SPACING = 8;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
background: background(theme.lowest),
|
background: background(theme.lowest),
|
||||||
blank_pane: {
|
blank_pane: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue