Compare commits

...

18 Commits

Author SHA1 Message Date
Danilo Leal
250ada7eb0 Merge branch 'main' into icon-button-square 2025-10-12 19:59:46 -03:00
Danilo Leal
54dcb140d4 Run cargo fmt 2025-09-12 20:56:09 -03:00
Danilo Leal
56c7d3fbd7 Remove .icon_size(IconSize::Small) - pt.4 2025-09-12 20:54:30 -03:00
Danilo Leal
8da30a382b Remove .icon_size(IconSize::Small) - pt.3 2025-09-12 20:52:36 -03:00
Danilo Leal
7c4e4a6593 Remove .icon_size(IconSize::Small) - pt.2 2025-09-12 20:48:54 -03:00
Danilo Leal
4564d164ed Remove .icon_size(IconSize::Small) - pt.1 2025-09-12 20:47:38 -03:00
Danilo Leal
55c58a5f21 Merge branch 'main' into icon-button-square 2025-09-12 20:18:55 -03:00
Danilo Leal
a19d33c21b Remove unused imports 2025-09-12 19:29:32 -03:00
Danilo Leal
39811b20ac Remove .shape(IconButtonShape::Square) - pt.3 2025-09-12 19:28:31 -03:00
Danilo Leal
1dc398d61f Remove imports 2025-09-12 18:00:14 -03:00
Danilo Leal
a005639689 Remove .shape(IconButtonShape::Square) - pt.2 2025-09-12 17:59:53 -03:00
Danilo Leal
7f1d80c2d9 Remove .shape(IconButtonShape::Square) - pt.1 2025-09-12 15:31:26 -03:00
Danilo Leal
ef494a8916 Merge remote-tracking branch 'origin/main' into icon-button-square 2025-09-12 15:14:38 -03:00
Danilo Leal
7a51c95dac Merge branch 'main' into icon-button-square 2025-08-13 14:26:43 -03:00
Danilo Leal
2dab8a5586 Adjust tab icon size 2025-08-12 17:11:19 -03:00
Danilo Leal
0b47c5cdce Fix case where we want it to be wide 2025-08-12 17:11:05 -03:00
Danilo Leal
a040d7bc8d Adjust icon button padding value per size 2025-08-12 17:10:59 -03:00
Danilo Leal
641763029b Make square-shaped + small icon button the default 2025-08-12 17:10:48 -03:00
39 changed files with 98 additions and 160 deletions

View File

@@ -11,10 +11,7 @@ use gpui::{
use std::{fmt::Display, ops::Range};
use text::Bias;
use time::{OffsetDateTime, UtcOffset};
use ui::{
HighlightedLabel, IconButtonShape, ListItem, ListItemSpacing, Tooltip, WithScrollbar,
prelude::*,
};
use ui::{HighlightedLabel, ListItem, ListItemSpacing, Tooltip, WithScrollbar, prelude::*};
pub struct AcpThreadHistory {
pub(crate) history_store: Entity<HistoryStore>,
@@ -423,7 +420,6 @@ impl AcpThreadHistory {
.end_slot::<IconButton>(if hovered {
Some(
IconButton::new("delete", IconName::Trash)
.shape(IconButtonShape::Square)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.tooltip(move |window, cx| {
@@ -595,7 +591,6 @@ impl RenderOnce for AcpHistoryEntryElement {
.end_slot::<IconButton>(if self.hovered || self.selected {
Some(
IconButton::new("delete", IconName::Trash)
.shape(IconButtonShape::Square)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.tooltip(move |window, cx| {

View File

@@ -27,7 +27,7 @@ use std::{
ops::Range,
sync::Arc,
};
use ui::{CommonAnimationExt, IconButtonShape, KeyBinding, Tooltip, prelude::*, vertical_divider};
use ui::{CommonAnimationExt, KeyBinding, Tooltip, prelude::*, vertical_divider};
use util::ResultExt;
use workspace::{
Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView,
@@ -825,7 +825,6 @@ fn render_diff_hunk_controls(
|el| {
el.child(
IconButton::new(("next-hunk", row as u64), IconName::ArrowDown)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
// .disabled(!has_multiple_hunks)
.tooltip({
@@ -861,7 +860,6 @@ fn render_diff_hunk_controls(
)
.child(
IconButton::new(("prev-hunk", row as u64), IconName::ArrowUp)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
// .disabled(!has_multiple_hunks)
.tooltip({

View File

@@ -22,7 +22,7 @@ use std::rc::Rc;
use std::sync::Arc;
use theme::ThemeSettings;
use ui::utils::WithRemSize;
use ui::{IconButtonShape, KeyBinding, PopoverMenuHandle, Tooltip, prelude::*};
use ui::{KeyBinding, PopoverMenuHandle, Tooltip, prelude::*};
use workspace::Workspace;
use zed_actions::agent::ToggleModelSelector;
@@ -468,7 +468,6 @@ impl<T: 'static> PromptEditor<T> {
CodegenStatus::Pending => vec![
IconButton::new("stop", IconName::Stop)
.icon_color(Color::Error)
.shape(IconButtonShape::Square)
.tooltip(move |window, cx| {
Tooltip::with_meta(
mode.tooltip_interrupt(),
@@ -487,7 +486,6 @@ impl<T: 'static> PromptEditor<T> {
vec![
IconButton::new("restart", IconName::RotateCw)
.icon_color(Color::Info)
.shape(IconButtonShape::Square)
.tooltip(move |window, cx| {
Tooltip::with_meta(
mode.tooltip_restart(),
@@ -505,7 +503,6 @@ impl<T: 'static> PromptEditor<T> {
} else {
let accept = IconButton::new("accept", IconName::Check)
.icon_color(Color::Info)
.shape(IconButtonShape::Square)
.tooltip(move |window, cx| {
Tooltip::for_action(mode.tooltip_accept(), &menu::Confirm, window, cx)
})
@@ -519,7 +516,6 @@ impl<T: 'static> PromptEditor<T> {
accept,
IconButton::new("confirm", IconName::PlayFilled)
.icon_color(Color::Info)
.shape(IconButtonShape::Square)
.tooltip(|window, cx| {
Tooltip::for_action(
"Execute Generated Command",
@@ -570,7 +566,6 @@ impl<T: 'static> PromptEditor<T> {
fn render_close_button(&self, cx: &mut Context<Self>) -> AnyElement {
IconButton::new("cancel", IconName::Close)
.icon_color(Color::Muted)
.shape(IconButtonShape::Square)
.tooltip(Tooltip::text("Close Assistant"))
.on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::CancelRequested)))
.into_any_element()
@@ -613,7 +608,6 @@ impl<T: 'static> PromptEditor<T> {
IconButton::new("previous", IconName::ChevronLeft)
.icon_color(Color::Muted)
.disabled(disabled || current_index == 0)
.shape(IconButtonShape::Square)
.tooltip({
let focus_handle = self.editor.focus_handle(cx);
move |window, cx| {
@@ -655,7 +649,6 @@ impl<T: 'static> PromptEditor<T> {
IconButton::new("next", IconName::ChevronRight)
.icon_color(Color::Muted)
.disabled(disabled || current_index == total_models - 1)
.shape(IconButtonShape::Square)
.tooltip({
let focus_handle = self.editor.focus_handle(cx);
move |window, cx| {

View File

@@ -10,7 +10,7 @@ use language_model::LanguageModelImage;
use project::Project;
use prompt_store::PromptStore;
use rope::Point;
use ui::{IconButtonShape, Tooltip, prelude::*, tooltip_container};
use ui::{Tooltip, prelude::*, tooltip_container};
use agent::context::{
AgentContextHandle, ContextId, ContextKind, DirectoryContextHandle, FetchedUrlContext,
@@ -199,7 +199,6 @@ impl RenderOnce for ContextPill {
context.handle.element_id("remove".into()),
IconName::Close,
)
.shape(IconButtonShape::Square)
.icon_size(IconSize::XSmall)
.tooltip(Tooltip::text("Remove Context"))
.on_click({

View File

@@ -3,7 +3,7 @@ use gpui::{Context, EventEmitter, ParentElement, Render, Window};
use language::DiagnosticEntry;
use text::{Anchor, BufferId};
use ui::prelude::*;
use ui::{IconButton, IconButtonShape, IconName, Tooltip};
use ui::{IconButton, IconName, Tooltip};
use workspace::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, item::ItemHandle};
pub struct ToolbarControls {
@@ -69,7 +69,6 @@ impl Render for ToolbarControls {
div.child(
IconButton::new("stop-updating", IconName::Stop)
.icon_color(Color::Info)
.shape(IconButtonShape::Square)
.tooltip(Tooltip::for_action_title(
"Stop diagnostics update",
&ToggleDiagnosticsRefresh,
@@ -85,7 +84,6 @@ impl Render for ToolbarControls {
div.child(
IconButton::new("refresh-diagnostics", IconName::ArrowCircle)
.icon_color(Color::Info)
.shape(IconButtonShape::Square)
.disabled(!has_stale_excerpts)
.tooltip(Tooltip::for_action_title(
"Refresh diagnostics",
@@ -104,7 +102,6 @@ impl Render for ToolbarControls {
.child(
IconButton::new("toggle-warnings", IconName::Warning)
.icon_color(warning_color)
.shape(IconButtonShape::Square)
.tooltip(Tooltip::text(warning_tooltip))
.on_click(cx.listener(|this, _, window, cx| {
if let Some(editor) = &this.editor {

View File

@@ -26,7 +26,7 @@ use std::{
use supermaven::{AccountStatus, Supermaven};
use ui::{
Clickable, ContextMenu, ContextMenuEntry, DocumentationEdge, DocumentationSide, IconButton,
IconButtonShape, Indicator, PopoverMenu, PopoverMenuHandle, ProgressBar, Tooltip, prelude::*,
Indicator, PopoverMenu, PopoverMenuHandle, ProgressBar, Tooltip, prelude::*,
};
use workspace::{
StatusItemView, Toast, Workspace, create_and_open_local_file, item::ItemHandle,
@@ -314,7 +314,6 @@ impl Render for EditPredictionButton {
return div().child(
IconButton::new("zed-predict-pending-button", zeta_icon)
.shape(IconButtonShape::Square)
.indicator(Indicator::dot().color(Color::Muted))
.indicator_border_color(Some(cx.theme().colors().status_bar_background))
.tooltip(move |window, cx| {
@@ -352,7 +351,6 @@ impl Render for EditPredictionButton {
let show_editor_predictions = self.editor_show_predictions;
let icon_button = IconButton::new("zed-predict-pending-button", zeta_icon)
.shape(IconButtonShape::Square)
.when(
enabled && (!show_editor_predictions || over_limit),
|this| {

View File

@@ -191,8 +191,8 @@ use theme::{
observe_buffer_font_size_adjustment,
};
use ui::{
ButtonSize, ButtonStyle, ContextMenu, Disclosure, IconButton, IconButtonShape, IconName,
IconSize, Indicator, Key, Tooltip, h_flex, prelude::*, scrollbars::ScrollbarAutoHide,
ButtonSize, ButtonStyle, ContextMenu, Disclosure, IconButton, IconName, IconSize, Indicator,
Key, Tooltip, h_flex, prelude::*, scrollbars::ScrollbarAutoHide,
};
use util::{RangeExt, ResultExt, TryFutureExt, maybe, post_inc};
use workspace::{
@@ -24782,7 +24782,6 @@ fn render_diff_hunk_controls(
|el| {
el.child(
IconButton::new(("next-hunk", row as u64), IconName::ArrowDown)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
// .disabled(!has_multiple_hunks)
.tooltip({
@@ -24818,7 +24817,6 @@ fn render_diff_hunk_controls(
)
.child(
IconButton::new(("prev-hunk", row as u64), IconName::ArrowUp)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
// .disabled(!has_multiple_hunks)
.tooltip({

View File

@@ -3093,9 +3093,10 @@ impl EditorElement {
};
let toggle = IconButton::new(("expand", ix), icon_name)
.icon_color(Color::Custom(cx.theme().colors().editor_line_number))
.selected_icon_color(Color::Custom(cx.theme().colors().editor_foreground))
.icon_color(Color::Custom(cx.theme().colors().editor_line_number))
.icon_size(IconSize::Custom(rems(editor_font_size / window.rem_size())))
.shape(ui::IconButtonShape::Wide)
.width(width)
.on_click(move |_, window, cx| {
editor.update(cx, |editor, cx| {

View File

@@ -14,8 +14,8 @@ use text::Rope;
use theme::ThemeSettings;
use ui::{
ActiveTheme, AnyElement, ButtonCommon, ButtonStyle, Clickable, FluentBuilder, IconButton,
IconButtonShape, IconName, IconSize, InteractiveElement, IntoElement, Label, LabelCommon,
LabelSize, ParentElement, Pixels, SharedString, StatefulInteractiveElement, Styled, StyledExt,
IconName, IconSize, InteractiveElement, IntoElement, Label, LabelCommon, LabelSize,
ParentElement, Pixels, SharedString, StatefulInteractiveElement, Styled, StyledExt,
WithScrollbar, div, relative,
};
@@ -393,7 +393,6 @@ impl SignatureHelpPopover {
let controls = if self.signatures.len() > 1 {
let prev_button = IconButton::new("signature_help_prev", IconName::ChevronUp)
.shape(IconButtonShape::Square)
.style(ButtonStyle::Subtle)
.icon_size(IconSize::Small)
.tooltip(move |window, cx| {
@@ -409,7 +408,6 @@ impl SignatureHelpPopover {
}));
let next_button = IconButton::new("signature_help_next", IconName::ChevronDown)
.shape(IconButtonShape::Square)
.style(ButtonStyle::Subtle)
.icon_size(IconSize::Small)
.tooltip(move |window, cx| {

View File

@@ -17,7 +17,7 @@ use settings::Settings as _;
use theme::ThemeSettings;
use time::OffsetDateTime;
use time_format::format_local_timestamp;
use ui::{ContextMenu, Divider, IconButtonShape, prelude::*, tooltip_container};
use ui::{ContextMenu, Divider, prelude::*};
use workspace::Workspace;
const GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED: usize = 20;
@@ -337,7 +337,6 @@ impl BlameRenderer for GitBlameRenderer {
)
.child(
IconButton::new("copy-sha-button", IconName::Copy)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
.icon_color(Color::Muted)
.on_click(move |_, _, cx| {

View File

@@ -15,7 +15,7 @@ use std::hash::Hash;
use theme::ThemeSettings;
use time::{OffsetDateTime, UtcOffset};
use time_format::format_local_timestamp;
use ui::{Avatar, Divider, IconButtonShape, prelude::*, tooltip_container};
use ui::{Avatar, Divider, prelude::*, tooltip_container};
use workspace::Workspace;
#[derive(Clone, Debug)]
@@ -330,7 +330,6 @@ impl Render for CommitTooltip {
)
.child(
IconButton::new("copy-sha-button", IconName::Copy)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
.icon_color(Color::Muted)
.on_click(move |_, _, cx| {

View File

@@ -1754,7 +1754,6 @@ impl Render for KeymapEditor {
)
}
})
.shape(IconButtonShape::Square)
.toggle_state(exact_match)
.on_click(
cx.listener(|_, _, window, cx| {
@@ -2029,9 +2028,7 @@ fn row_group_id(row_index: usize) -> SharedString {
}
fn base_button_style(row_index: usize, icon: IconName) -> IconButton {
IconButton::new(("keymap-icon", row_index), icon)
.shape(IconButtonShape::Square)
.size(ButtonSize::Compact)
IconButton::new(("keymap-icon", row_index), icon).size(ButtonSize::Compact)
}
#[derive(Debug, Clone, IntoElement)]

View File

@@ -3,8 +3,8 @@ use gpui::{
KeybindingKeystroke, Keystroke, Modifiers, ModifiersChangedEvent, Subscription, Task, actions,
};
use ui::{
ActiveTheme as _, Color, IconButton, IconButtonShape, IconName, IconSize, Label, LabelSize,
ParentElement as _, Render, Styled as _, Tooltip, Window, prelude::*,
ActiveTheme as _, Color, IconButton, IconName, IconSize, Label, LabelSize, ParentElement as _,
Render, Styled as _, Tooltip, Window, prelude::*,
};
actions!(
@@ -599,7 +599,6 @@ impl Render for KeystrokeInput {
if is_recording {
this.child(
IconButton::new("stop-record-btn", IconName::Stop)
.shape(IconButtonShape::Square)
.map(|this| {
this.tooltip(Tooltip::for_action_title(
if self.search {
@@ -618,7 +617,6 @@ impl Render for KeystrokeInput {
} else {
this.child(
IconButton::new("record-btn", record_icon)
.shape(IconButtonShape::Square)
.map(|this| {
this.tooltip(Tooltip::for_action_title(
if self.search {
@@ -638,7 +636,6 @@ impl Render for KeystrokeInput {
})
.child(
IconButton::new("clear-btn", IconName::Backspace)
.shape(IconButtonShape::Square)
.tooltip(Tooltip::for_action_title(
"Clear Keystrokes",
&ClearKeystrokes,

View File

@@ -4,8 +4,8 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use db::kvp::KEY_VALUE_STORE;
use gpui::{App, EntityId, EventEmitter, Subscription};
use ui::{IconButtonShape, Tooltip, prelude::*};
use workspace::item::{ItemBufferKind, ItemEvent, ItemHandle};
use ui::{Tooltip, prelude::*};
use workspace::item::{ItemEvent, ItemHandle};
use workspace::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView};
pub struct MultibufferHint {
@@ -169,7 +169,6 @@ impl Render for MultibufferHint {
)
.child(
IconButton::new("dismiss", IconName::Close)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
.on_click(cx.listener(|this, _event, _, cx| {
this.dismiss(cx);

View File

@@ -47,9 +47,9 @@ use smol::channel;
use theme::{SyntaxTheme, ThemeSettings};
use ui::{
ActiveTheme, ButtonCommon, Clickable, Color, ContextMenu, DynamicSpacing, FluentBuilder,
HighlightedLabel, Icon, IconButton, IconButtonShape, IconName, IconSize, IndentGuideColors,
IndentGuideLayout, Label, LabelCommon, ListItem, ScrollAxes, Scrollbars, StyledExt,
StyledTypography, Toggleable, Tooltip, WithScrollbar, h_flex, v_flex,
HighlightedLabel, Icon, IconButton, IconName, IconSize, IndentGuideColors, IndentGuideLayout,
Label, LabelCommon, ListItem, ScrollAxes, Scrollbars, StyledExt, StyledTypography, Toggleable,
Tooltip, WithScrollbar, h_flex, v_flex,
};
use util::{RangeExt, ResultExt, TryFutureExt, debug_panic, rel_path::RelPath};
use workspace::{
@@ -4733,7 +4733,6 @@ impl OutlinePanel {
} else {
"Pin Active Outline"
}))
.shape(IconButtonShape::Square)
.on_click(cx.listener(
|outline_panel, _, window, cx| {
outline_panel.toggle_active_editor_pin(

View File

@@ -37,8 +37,8 @@ use std::{
},
};
use ui::{
IconButtonShape, List, ListItem, ListSeparator, Modal, ModalHeader, Navigable, NavigableEntry,
Section, Tooltip, WithScrollbar, prelude::*,
List, ListItem, ListSeparator, Modal, ModalHeader, Navigable, NavigableEntry, Section, Tooltip,
WithScrollbar, prelude::*,
};
use util::{
ResultExt,
@@ -1295,7 +1295,6 @@ impl RemoteServerProjects {
// Right-margin to offset it from the Scrollbar
IconButton::new("remove-remote-project", IconName::Trash)
.icon_size(IconSize::Small)
.shape(IconButtonShape::Square)
.size(ButtonSize::Large)
.tooltip(Tooltip::text("Delete Remote Project"))
.on_click(cx.listener(move |this, _, _, cx| {

View File

@@ -56,9 +56,7 @@ impl CellControl {
fn new(id: impl Into<SharedString>, control_type: CellControlType) -> Self {
let icon_name = control_type.icon_name();
let id = id.into();
let button = IconButton::new(id, icon_name)
.icon_size(IconSize::Small)
.shape(IconButtonShape::Square);
let button = IconButton::new(id, icon_name).icon_size(IconSize::Small);
Self { button }
}
}

View File

@@ -29,7 +29,7 @@ use runtimelib::{
};
use std::{env::temp_dir, ops::Range, sync::Arc, time::Duration};
use theme::ActiveTheme;
use ui::{IconButtonShape, Tooltip, prelude::*};
use ui::{Tooltip, prelude::*};
use util::ResultExt as _;
pub struct Session {
@@ -151,7 +151,6 @@ impl EditorBlock {
.icon_size(IconSize::Small)
.icon_color(Color::Muted)
.size(ButtonSize::Compact)
.shape(IconButtonShape::Square)
.tooltip(Tooltip::text("Close output area"))
.on_click(move |_, window, cx| {
if let BlockId::Custom(block_id) = block_id {

View File

@@ -31,8 +31,7 @@ use std::sync::Arc;
use zed_actions::{outline::ToggleOutline, workspace::CopyPath, workspace::CopyRelativePath};
use ui::{
BASE_REM_SIZE_IN_PX, IconButton, IconButtonShape, IconName, Tooltip, h_flex, prelude::*,
utils::SearchInputWidth,
BASE_REM_SIZE_IN_PX, IconButton, IconName, Tooltip, h_flex, prelude::*, utils::SearchInputWidth,
};
use util::{ResultExt, paths::PathMatcher};
use workspace::{
@@ -256,7 +255,6 @@ impl Render for BufferSearchBar {
IconName::Quote,
)
.style(ButtonStyle::Subtle)
.shape(IconButtonShape::Square)
.when(self.selection_search_enabled.is_some(), |button| {
button.style(ButtonStyle::Filled)
})

View File

@@ -2044,7 +2044,6 @@ impl Render for ProjectSearchBar {
.min_w_64()
.child(
IconButton::new("project-search-filter-button", IconName::Filter)
.shape(IconButtonShape::Square)
.tooltip(|window, cx| {
Tooltip::for_action("Toggle Filters", &ToggleFilters, window, cx)
})
@@ -2144,7 +2143,6 @@ impl Render for ProjectSearchBar {
.min_w_64()
.child(
IconButton::new("project-search-opened-only", IconName::FolderSearch)
.shape(IconButtonShape::Square)
.toggle_state(self.is_opened_only_enabled(cx))
.tooltip(Tooltip::text("Only Search Open Files"))
.on_click(cx.listener(|this, _, window, cx| {

View File

@@ -4,7 +4,7 @@ use editor::SearchSettings;
use gpui::{Action, App, ClickEvent, FocusHandle, IntoElement, actions};
use project::search::SearchQuery;
pub use project_search::ProjectSearchView;
use ui::{ButtonStyle, IconButton, IconButtonShape};
use ui::{ButtonStyle, IconButton};
use ui::{Tooltip, prelude::*};
use workspace::notifications::NotificationId;
use workspace::{Toast, Workspace};
@@ -156,7 +156,6 @@ impl SearchOption {
}
})
.style(ButtonStyle::Subtle)
.shape(IconButtonShape::Square)
.toggle_state(active.contains(self.as_options()))
.tooltip({
move |window, cx| Tooltip::for_action_in(label, action, &focus_handle, window, cx)

View File

@@ -2,7 +2,7 @@ use editor::{Editor, EditorElement, EditorStyle};
use gpui::{Action, Entity, FocusHandle, Hsla, IntoElement, TextStyle};
use settings::Settings;
use theme::ThemeSettings;
use ui::{IconButton, IconButtonShape};
use ui::IconButton;
use ui::{Tooltip, prelude::*};
pub(super) enum ActionButtonState {
@@ -22,7 +22,6 @@ pub(super) fn render_action_button(
SharedString::from(format!("{id_prefix}-{}", action.name())),
icon,
)
.shape(IconButtonShape::Square)
.on_click({
let focus_handle = focus_handle.clone();
move |_, window, cx| {

View File

@@ -13,9 +13,8 @@ use picker::{Picker, PickerDelegate, highlighted_match_with_paths::HighlightedMa
use project::{TaskSourceKind, task_store::TaskStore};
use task::{DebugScenario, ResolvedTask, RevealTarget, TaskContext, TaskTemplate};
use ui::{
ActiveTheme, Clickable, FluentBuilder as _, IconButtonShape, IconWithIndicator, Indicator,
IntoElement, KeyBinding, ListItem, ListItemSpacing, RenderOnce, Toggleable, Tooltip, div,
prelude::*,
ActiveTheme, Clickable, FluentBuilder as _, IconWithIndicator, Indicator, IntoElement,
KeyBinding, ListItem, ListItemSpacing, RenderOnce, Toggleable, Tooltip, div, prelude::*,
};
use util::{ResultExt, truncate_and_trailoff};
@@ -555,7 +554,6 @@ impl PickerDelegate for TasksModalDelegate {
let task_index = hit.candidate_id;
let delete_button = div().child(
IconButton::new("delete", IconName::Close)
.shape(IconButtonShape::Square)
.icon_color(Color::Muted)
.size(ButtonSize::None)
.icon_size(IconSize::XSmall)

View File

@@ -151,7 +151,7 @@ impl TerminalPanel {
.child(
PopoverMenu::new("terminal-tab-bar-popover-menu")
.trigger_with_tooltip(
IconButton::new("plus", IconName::Plus).icon_size(IconSize::Small),
IconButton::new("plus", IconName::Plus),
Tooltip::text("New…"),
)
.anchor(Corner::TopRight)
@@ -180,8 +180,7 @@ impl TerminalPanel {
.child(
PopoverMenu::new("terminal-pane-tab-bar-split")
.trigger_with_tooltip(
IconButton::new("terminal-pane-split", IconName::Split)
.icon_size(IconSize::Small),
IconButton::new("terminal-pane-split", IconName::Split),
Tooltip::text("Split Pane"),
)
.anchor(Corner::TopRight)
@@ -205,7 +204,6 @@ impl TerminalPanel {
.child({
let zoomed = pane.is_zoomed();
IconButton::new("toggle_zoom", IconName::Maximize)
.icon_size(IconSize::Small)
.toggle_state(zoomed)
.selected_icon(IconName::Minimize)
.on_click(cx.listener(|pane, _, window, cx| {
@@ -1621,7 +1619,6 @@ impl Render for InlineAssistTabBarButton {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let focus_handle = self.focus_handle.clone();
IconButton::new("terminal_inline_assistant", IconName::ZedAssistant)
.icon_size(IconSize::Small)
.on_click(cx.listener(|_, _, window, cx| {
window.dispatch_action(InlineAssist::default().boxed_clone(), cx);
}))

View File

@@ -836,7 +836,6 @@ impl TerminalView {
let task_id = task.spawned_task.id.clone();
Some(
IconButton::new("rerun-icon", IconName::Rerun)
.icon_size(IconSize::Small)
.size(ButtonSize::Compact)
.icon_color(Color::Default)
.shape(ui::IconButtonShape::Square)

View File

@@ -155,8 +155,7 @@ impl ApplicationMenu {
SharedString::from(format!("{}-menu-trigger", menu_name)),
ui::IconName::Menu,
)
.style(ButtonStyle::Subtle)
.icon_size(IconSize::Small),
.style(ButtonStyle::Subtle),
Tooltip::text("Open Application Menu"),
)
.with_handle(handle),

View File

@@ -356,7 +356,6 @@ impl TitleBar {
IconButton::new("leave-call", IconName::Exit)
.style(ButtonStyle::Subtle)
.tooltip(Tooltip::text("Leave Call"))
.icon_size(IconSize::Small)
.on_click(move |_, _window, cx| {
ActiveCall::global(cx)
.update(cx, |call, cx| call.hang_up(cx))
@@ -421,7 +420,6 @@ impl TitleBar {
}
})
.style(ButtonStyle::Subtle)
.icon_size(IconSize::Small)
.toggle_state(is_muted)
.selected_style(ButtonStyle::Tinted(TintColor::Error))
.on_click(move |_, _window, cx| {
@@ -442,7 +440,6 @@ impl TitleBar {
)
.style(ButtonStyle::Subtle)
.selected_style(ButtonStyle::Tinted(TintColor::Error))
.icon_size(IconSize::Small)
.toggle_state(is_deafened)
.tooltip(move |window, cx| {
if is_deafened {
@@ -470,7 +467,6 @@ impl TitleBar {
if can_use_microphone && screen_sharing_supported {
let trigger = IconButton::new("screen-share", IconName::Screen)
.style(ButtonStyle::Subtle)
.icon_size(IconSize::Small)
.toggle_state(is_screen_sharing)
.selected_style(ButtonStyle::Tinted(TintColor::Accent))
.tooltip(Tooltip::text(if is_screen_sharing {

View File

@@ -7,8 +7,8 @@ use gpui::{
use theme::ThemeSettings;
use ui::{
Color, ContextMenu, DynamicSpacing, IconButton, IconButtonShape, IconName, IconSize, Label,
LabelSize, Tab, h_flex, prelude::*, right_click_menu,
Color, ContextMenu, DynamicSpacing, IconButton, IconName, IconSize, Label, LabelSize, Tab,
h_flex, prelude::*, right_click_menu,
};
use workspace::{
CloseWindow, ItemSettings, Workspace, WorkspaceSettings,
@@ -242,7 +242,6 @@ impl SystemWindowTabs {
})
.child(
IconButton::new("close", IconName::Close)
.shape(IconButtonShape::Square)
.icon_color(Color::Muted)
.icon_size(IconSize::XSmall)
.on_click({
@@ -470,7 +469,6 @@ impl Render for SystemWindowTabs {
.border_color(cx.theme().colors().border)
.child(
IconButton::new("plus", IconName::Plus)
.icon_size(IconSize::Small)
.icon_color(Color::Muted)
.on_click(|_event, window, cx| {
window.dispatch_action(

View File

@@ -31,9 +31,9 @@ impl IconButton {
pub fn new(id: impl Into<ElementId>, icon: IconName) -> Self {
let mut this = Self {
base: ButtonLike::new(id),
shape: IconButtonShape::Wide,
shape: IconButtonShape::Square,
icon,
icon_size: IconSize::default(),
icon_size: IconSize::Small,
icon_color: Color::Default,
selected_icon: None,
selected_icon_color: None,
@@ -237,6 +237,43 @@ impl Component for IconButton {
example_group_with_title(
"Icon Button Styles",
vec![
// TODO: Remove/organize this later
single_example(
"SIZES",
h_flex()
.gap_0p5()
.child(
IconButton::new("tinted", IconName::Debug)
.icon_size(IconSize::Indicator)
.layer(ElevationIndex::Background)
.style(ButtonStyle::Tinted(TintColor::Accent)),
)
.child(
IconButton::new("tinted", IconName::Debug)
.icon_size(IconSize::XSmall)
.layer(ElevationIndex::Background)
.style(ButtonStyle::Tinted(TintColor::Accent)),
)
.child(
IconButton::new("tinted", IconName::Debug)
.icon_size(IconSize::Small)
.layer(ElevationIndex::Background)
.style(ButtonStyle::Tinted(TintColor::Accent)),
)
.child(
IconButton::new("tinted", IconName::Debug)
.icon_size(IconSize::Medium)
.layer(ElevationIndex::Background)
.style(ButtonStyle::Tinted(TintColor::Accent)),
)
.child(
IconButton::new("tinted", IconName::Debug)
.icon_size(IconSize::XLarge)
.layer(ElevationIndex::Background)
.style(ButtonStyle::Tinted(TintColor::Accent)),
)
.into_any_element(),
),
single_example(
"Default",
IconButton::new("default", IconName::Check)
@@ -279,7 +316,6 @@ impl Component for IconButton {
single_example(
"Square",
IconButton::new("square", IconName::Check)
.shape(IconButtonShape::Square)
.style(ButtonStyle::Filled)
.layer(ElevationIndex::Background)
.into_any_element(),

View File

@@ -1,6 +1,6 @@
use crate::{
Icon, IconButtonShape, IconName, IconSize, KeyBinding, Label, List, ListItem, ListSeparator,
ListSubHeader, h_flex, prelude::*, utils::WithRemSize, v_flex,
Icon, IconName, IconSize, KeyBinding, Label, List, ListItem, ListSeparator, ListSubHeader,
h_flex, prelude::*, utils::WithRemSize, v_flex,
};
use gpui::{
Action, AnyElement, App, AppContext as _, DismissEvent, Entity, EventEmitter, FocusHandle,
@@ -1011,7 +1011,6 @@ impl ContextMenu {
|el, (((icon, action), title), handler)| {
el.end_slot({
let icon_button = IconButton::new("end-slot-icon", *icon)
.shape(IconButtonShape::Square)
.tooltip({
let action_context = self.action_context.clone();
let title = title.clone();

View File

@@ -2,7 +2,7 @@ use std::sync::Arc;
use gpui::{ClickEvent, CursorStyle, SharedString};
use crate::{Color, IconButton, IconButtonShape, IconName, IconSize, prelude::*};
use crate::{Color, IconButton, IconName, IconSize, prelude::*};
#[derive(IntoElement, RegisterComponent)]
pub struct Disclosure {
@@ -91,9 +91,7 @@ impl RenderOnce for Disclosure {
false => self.closed_icon,
},
)
.shape(IconButtonShape::Square)
.icon_color(Color::Muted)
.icon_size(IconSize::Small)
.disabled(self.disabled)
.toggle_state(self.selected)
.when_some(self.visible_on_hover.clone(), |this, group_name| {

View File

@@ -85,11 +85,12 @@ impl IconSize {
/// 2. The padding of one side of the square
pub fn square_components(&self, window: &mut Window, cx: &mut App) -> (Pixels, Pixels) {
let icon_size = self.rems() * window.rem_size();
let padding = match self {
IconSize::Indicator => DynamicSpacing::Base00.px(cx),
IconSize::XSmall => DynamicSpacing::Base02.px(cx),
IconSize::Small => DynamicSpacing::Base02.px(cx),
IconSize::Medium => DynamicSpacing::Base02.px(cx),
IconSize::Small => DynamicSpacing::Base04.px(cx),
IconSize::Medium => DynamicSpacing::Base06.px(cx),
IconSize::XLarge => DynamicSpacing::Base02.px(cx),
// TODO: Wire into dynamic spacing
IconSize::Custom(size) => size.to_pixels(window.rem_size()),

View File

@@ -1,6 +1,6 @@
use crate::{
Clickable, Color, DynamicSpacing, Headline, HeadlineSize, Icon, IconButton, IconButtonShape,
IconName, Label, LabelCommon, LabelSize, h_flex, v_flex,
Clickable, Color, DynamicSpacing, Headline, HeadlineSize, Icon, IconButton, IconName, Label,
LabelCommon, LabelSize, h_flex, v_flex,
};
use gpui::{prelude::FluentBuilder, *};
use smallvec::SmallVec;
@@ -177,13 +177,11 @@ impl RenderOnce for ModalHeader {
.pb(DynamicSpacing::Base04.rems(cx))
.gap(DynamicSpacing::Base08.rems(cx))
.when(self.show_back_button, |this| {
this.child(
IconButton::new("back", IconName::ArrowLeft)
.shape(IconButtonShape::Square)
.on_click(|_, window, cx| {
window.dispatch_action(menu::Cancel.boxed_clone(), cx);
}),
)
this.child(IconButton::new("back", IconName::ArrowLeft).on_click(
|_, window, cx| {
window.dispatch_action(menu::Cancel.boxed_clone(), cx);
},
))
})
.child(
v_flex()
@@ -200,11 +198,9 @@ impl RenderOnce for ModalHeader {
)
.when(self.show_dismiss_button, |this| {
this.child(
IconButton::new("dismiss", IconName::Close)
.shape(IconButtonShape::Square)
.on_click(|_, window, cx| {
window.dispatch_action(menu::Cancel.boxed_clone(), cx);
}),
IconButton::new("dismiss", IconName::Close).on_click(|_, window, cx| {
window.dispatch_action(menu::Cancel.boxed_clone(), cx);
}),
)
})
}

View File

@@ -2,7 +2,7 @@ use gpui::Render;
use story::{Story, StoryItem, StorySection};
use crate::{IconButton, IconName};
use crate::{IconButtonShape, Tooltip, prelude::*};
use crate::{Tooltip, prelude::*};
pub struct IconButtonStory;
@@ -116,33 +116,7 @@ impl Render for IconButtonStory {
Story::container(cx)
.child(Story::title_for::<IconButton>(cx))
.child(StorySection::new().children(buttons))
.child(
StorySection::new().child(StoryItem::new(
"Square",
h_flex()
.gap_2()
.child(
IconButton::new("square-medium", IconName::Close)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Medium),
)
.child(
IconButton::new("square-small", IconName::Close)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small),
)
.child(
IconButton::new("square-xsmall", IconName::Close)
.shape(IconButtonShape::Square)
.icon_size(IconSize::XSmall),
)
.child(
IconButton::new("square-indicator", IconName::Close)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Indicator),
),
)),
)
.child(StorySection::new().child(StoryItem::new("Square", h_flex().gap_2())))
.into_element()
}
}

View File

@@ -3,8 +3,8 @@ use std::cmp::Ordering;
use gpui::Render;
use story::Story;
use crate::{IconButtonShape, TabPosition, prelude::*};
use crate::{Indicator, Tab};
use crate::{TabPosition, prelude::*};
pub struct TabStory;
@@ -29,7 +29,6 @@ impl Render for TabStory {
.end_slot(
IconButton::new("close_button", IconName::Close)
.visible_on_hover("")
.shape(IconButtonShape::Square)
.icon_color(Color::Muted)
.size(ButtonSize::None)
.icon_size(IconSize::XSmall),

View File

@@ -927,7 +927,6 @@ impl Render for PanelButtons {
.attach(menu_attach)
.trigger(move |is_active, _window, _cx| {
IconButton::new(name, icon)
.icon_size(IconSize::Small)
.toggle_state(is_active_button)
.on_click({
let action = action.boxed_clone();

View File

@@ -46,9 +46,8 @@ use std::{
use theme::ThemeSettings;
use ui::{
ButtonSize, Color, ContextMenu, ContextMenuEntry, ContextMenuItem, DecoratedIcon, IconButton,
IconButtonShape, IconDecoration, IconDecorationKind, IconName, IconSize, Indicator, Label,
PopoverMenu, PopoverMenuHandle, Tab, TabBar, TabPosition, Tooltip, prelude::*,
right_click_menu,
IconDecoration, IconDecorationKind, IconName, IconSize, Indicator, Label, PopoverMenu,
PopoverMenuHandle, Tab, TabBar, TabPosition, Tooltip, prelude::*, right_click_menu,
};
use util::{ResultExt, debug_panic, maybe, paths::PathStyle, truncate_and_remove_front};
@@ -2681,10 +2680,9 @@ impl Pane {
end_slot_action = &TogglePinTab;
end_slot_tooltip_text = "Unpin Tab";
IconButton::new("unpin tab", IconName::Pin)
.shape(IconButtonShape::Square)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.size(ButtonSize::None)
.icon_size(IconSize::Small)
.on_click(cx.listener(move |pane, _, window, cx| {
pane.unpin_tab_at(ix, window, cx);
}))
@@ -2701,10 +2699,9 @@ impl Pane {
}
ShowCloseButton::Hidden => return this,
}
.shape(IconButtonShape::Square)
.icon_color(Color::Muted)
.size(ButtonSize::None)
.icon_size(IconSize::Small)
.icon_size(IconSize::XSmall)
.on_click(cx.listener(move |pane, _, window, cx| {
pane.close_item_by_id(item_id, SaveIntent::Close, window, cx)
.detach_and_log_err(cx);

View File

@@ -188,7 +188,6 @@ impl Render for QuickActionBar {
v_flex()
.child(
IconButton::new("toggle_code_actions_icon", IconName::BoltOutlined)
.icon_size(IconSize::Small)
.style(ButtonStyle::Subtle)
.disabled(!has_available_code_actions)
.toggle_state(is_deployed)
@@ -246,7 +245,6 @@ impl Render for QuickActionBar {
PopoverMenu::new("editor-selections-dropdown")
.trigger_with_tooltip(
IconButton::new("toggle_editor_selections_icon", IconName::CursorIBeam)
.icon_size(IconSize::Small)
.style(ButtonStyle::Subtle)
.toggle_state(self.toggle_selections_handle.is_deployed()),
Tooltip::text("Selection Controls"),
@@ -301,7 +299,6 @@ impl Render for QuickActionBar {
PopoverMenu::new("editor-settings")
.trigger_with_tooltip(
IconButton::new("toggle_editor_settings_icon", IconName::Sliders)
.icon_size(IconSize::Small)
.style(ButtonStyle::Subtle)
.toggle_state(self.toggle_settings_handle.is_deployed()),
Tooltip::text("Editor Controls"),
@@ -642,7 +639,6 @@ impl RenderOnce for QuickActionBarButton {
let action = self.action.boxed_clone();
IconButton::new(self.id.clone(), self.icon)
.icon_size(IconSize::Small)
.style(ButtonStyle::Subtle)
.toggle_state(self.toggled)
.tooltip(move |window, cx| {

View File

@@ -66,7 +66,6 @@ impl QuickActionBar {
};
let button = IconButton::new(button_id, IconName::Eye)
.icon_size(IconSize::Small)
.style(ButtonStyle::Subtle)
.tooltip(move |window, cx| {
Tooltip::with_meta(