mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-07 11:28:37 +03:00
Tweak warning diagnostic toggle (#18637)
This PR adds color to the warning diagnostic toggle, so that, if it's turned on, the warning icon is yellow. And, in the opposite case, it's muted. | Turned on | Turned off | |--------|--------| | <img width="1136" alt="Screenshot 2024-10-02 at 6 08 30 PM" src="https://github.com/user-attachments/assets/be64738b-4c14-41d4-b1d4-ad788cf9e72b"> | <img width="1136" alt="Screenshot 2024-10-02 at 6 08 36 PM" src="https://github.com/user-attachments/assets/d144ff50-4bf6-4c23-925a-05bcbbcd8b9d"> | --- Release Notes: - N/A
This commit is contained in:
parent
5aaaed52fc
commit
a5f50e5c1e
@ -1,7 +1,7 @@
|
|||||||
use crate::ProjectDiagnosticsEditor;
|
use crate::ProjectDiagnosticsEditor;
|
||||||
use gpui::{EventEmitter, ParentElement, Render, View, ViewContext, WeakView};
|
use gpui::{EventEmitter, ParentElement, Render, View, ViewContext, WeakView};
|
||||||
use ui::prelude::*;
|
use ui::prelude::*;
|
||||||
use ui::{IconButton, IconName, Tooltip};
|
use ui::{IconButton, IconButtonShape, IconName, Tooltip};
|
||||||
use workspace::{item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView};
|
use workspace::{item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView};
|
||||||
|
|
||||||
pub struct ToolbarControls {
|
pub struct ToolbarControls {
|
||||||
@ -33,11 +33,19 @@ impl Render for ToolbarControls {
|
|||||||
"Include Warnings"
|
"Include Warnings"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let warning_color = if include_warnings {
|
||||||
|
Color::Warning
|
||||||
|
} else {
|
||||||
|
Color::Muted
|
||||||
|
};
|
||||||
|
|
||||||
h_flex()
|
h_flex()
|
||||||
|
.gap_1()
|
||||||
.when(has_stale_excerpts, |div| {
|
.when(has_stale_excerpts, |div| {
|
||||||
div.child(
|
div.child(
|
||||||
IconButton::new("update-excerpts", IconName::Update)
|
IconButton::new("update-excerpts", IconName::Update)
|
||||||
.icon_color(Color::Info)
|
.icon_color(Color::Info)
|
||||||
|
.shape(IconButtonShape::Square)
|
||||||
.disabled(is_updating)
|
.disabled(is_updating)
|
||||||
.tooltip(move |cx| Tooltip::text("Update excerpts", cx))
|
.tooltip(move |cx| Tooltip::text("Update excerpts", cx))
|
||||||
.on_click(cx.listener(|this, _, cx| {
|
.on_click(cx.listener(|this, _, cx| {
|
||||||
@ -51,6 +59,8 @@ impl Render for ToolbarControls {
|
|||||||
})
|
})
|
||||||
.child(
|
.child(
|
||||||
IconButton::new("toggle-warnings", IconName::Warning)
|
IconButton::new("toggle-warnings", IconName::Warning)
|
||||||
|
.icon_color(warning_color)
|
||||||
|
.shape(IconButtonShape::Square)
|
||||||
.tooltip(move |cx| Tooltip::text(tooltip, cx))
|
.tooltip(move |cx| Tooltip::text(tooltip, cx))
|
||||||
.on_click(cx.listener(|this, _, cx| {
|
.on_click(cx.listener(|this, _, cx| {
|
||||||
if let Some(editor) = this.editor() {
|
if let Some(editor) = this.editor() {
|
||||||
|
Loading…
Reference in New Issue
Block a user