diff --git a/crates/app/src/story_workspace.rs b/crates/app/src/story_workspace.rs index 97b6ca46..eda08fa9 100644 --- a/crates/app/src/story_workspace.rs +++ b/crates/app/src/story_workspace.rs @@ -310,7 +310,7 @@ impl Render for StoryWorkspace { .gap_2() .child(self.theme_color_picker.clone()) .child( - Button::new("theme-mode", cx) + Button::new("theme-mode") .map(|this| { if cx.theme().mode.is_dark() { this.icon(IconName::Sun) @@ -331,7 +331,7 @@ impl Render for StoryWorkspace { ) .child(self.locale_selector.clone()) .child( - Button::new("github", cx) + Button::new("github") .icon(IconName::GitHub) .small() .ghost() @@ -343,7 +343,7 @@ impl Render for StoryWorkspace { div() .relative() .child( - Button::new("bell", cx) + Button::new("bell") .small() .ghost() .compact() @@ -403,7 +403,7 @@ impl Render for LocaleSelector { .track_focus(&focus_handle) .on_action(cx.listener(Self::on_select_locale)) .child( - Button::new("btn", cx) + Button::new("btn") .small() .ghost() .icon(IconName::Globe) diff --git a/crates/story/src/button_story.rs b/crates/story/src/button_story.rs index fcfec704..bda8490f 100644 --- a/crates/story/src/button_story.rs +++ b/crates/story/src/button_story.rs @@ -133,7 +133,7 @@ impl Render for ButtonStory { .child( section("Normal Button", cx) .child( - Button::new("button-1", cx) + Button::new("button-1") .primary() .label("Primary Button") .disabled(disabled) @@ -143,7 +143,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-2", cx) + Button::new("button-2") .label("Secondary Button") .disabled(disabled) .selected(selected) @@ -152,7 +152,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-4", cx) + Button::new("button-4") .danger() .label("Danger Button") .disabled(disabled) @@ -162,7 +162,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-5", cx) + Button::new("button-5") .outline() .label("Outline Button") .disabled(disabled) @@ -172,7 +172,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-5-ghost", cx) + Button::new("button-5-ghost") .ghost() .label("Ghost Button") .disabled(disabled) @@ -182,7 +182,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-5-link", cx) + Button::new("button-5-link") .link() .label("Link Button") .disabled(disabled) @@ -192,7 +192,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-5-text", cx) + Button::new("button-5-text") .text() .label("Text Button") .disabled(disabled) @@ -202,7 +202,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-6-custom", cx) + Button::new("button-6-custom") .custom( ButtonCustomStyle::new(cx) .color(if cx.theme().mode.is_dark() { @@ -242,7 +242,7 @@ impl Render for ButtonStory { .child( section("Button with Icon", cx) .child( - Button::new("button-icon-1", cx) + Button::new("button-icon-1") .primary() .label("Confirm") .icon(IconName::Check) @@ -253,7 +253,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-icon-2", cx) + Button::new("button-icon-2") .label("Abort") .icon(IconName::Close) .disabled(disabled) @@ -263,7 +263,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-icon-3", cx) + Button::new("button-icon-3") .label("Maximize") .icon(Icon::new(IconName::Maximize)) .disabled(disabled) @@ -273,7 +273,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-icon-4", cx) + Button::new("button-icon-4") .primary() .child( h_flex() @@ -290,7 +290,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-icon-5-ghost", cx) + Button::new("button-icon-5-ghost") .ghost() .icon(IconName::Check) .label("Confirm") @@ -301,7 +301,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-icon-6-link", cx) + Button::new("button-icon-6-link") .link() .icon(IconName::Check) .label("Link") @@ -312,7 +312,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-icon-6-text", cx) + Button::new("button-icon-6-text") .text() .icon(IconName::Check) .label("Text Button") @@ -330,7 +330,7 @@ impl Render for ButtonStory { .child( section("Small Size", cx) .child( - Button::new("button-6", cx) + Button::new("button-6") .label("Primary Button") .primary() .small() @@ -342,7 +342,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-7", cx) + Button::new("button-7") .label("Secondary Button") .small() .disabled(disabled) @@ -352,7 +352,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-8", cx) + Button::new("button-8") .label("Danger Button") .danger() .small() @@ -363,7 +363,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-8-outline", cx) + Button::new("button-8-outline") .label("Outline Button") .outline() .small() @@ -374,7 +374,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-8-ghost", cx) + Button::new("button-8-ghost") .label("Ghost Button") .ghost() .small() @@ -385,7 +385,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-8-link", cx) + Button::new("button-8-link") .label("Link Button") .link() .small() @@ -399,7 +399,7 @@ impl Render for ButtonStory { .child( section("XSmall Size", cx) .child( - Button::new("button-xs-1", cx) + Button::new("button-xs-1") .label("Primary Button") .primary() .xsmall() @@ -410,7 +410,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-xs-2", cx) + Button::new("button-xs-2") .label("Secondary Button") .xsmall() .loading(true) @@ -421,7 +421,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-xs-3", cx) + Button::new("button-xs-3") .label("Danger Button") .danger() .xsmall() @@ -432,7 +432,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-xs-3-ghost", cx) + Button::new("button-xs-3-ghost") .label("Ghost Button") .ghost() .xsmall() @@ -443,7 +443,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-xs-3-outline", cx) + Button::new("button-xs-3-outline") .label("Outline Button") .outline() .xsmall() @@ -454,7 +454,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-xs-3-link", cx) + Button::new("button-xs-3-link") .label("Link Button") .link() .xsmall() @@ -473,7 +473,7 @@ impl Render for ButtonStory { .small() .disabled(disabled) .child( - Button::new("button-one", cx) + Button::new("button-one") .label("One") .disabled(disabled) .selected(selected) @@ -481,7 +481,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-two", cx) + Button::new("button-two") .label("Two") .disabled(disabled) .selected(selected) @@ -489,7 +489,7 @@ impl Render for ButtonStory { .on_click(Self::on_click), ) .child( - Button::new("button-three", cx) + Button::new("button-three") .label("Three") .disabled(disabled) .selected(selected) @@ -515,22 +515,22 @@ impl Render for ButtonStory { .compact() .multiple(toggle_multiple) .child( - Button::new("disabled-toggle-button", cx) + Button::new("disabled-toggle-button") .label("Disabled") .selected(disabled), ) .child( - Button::new("loading-toggle-button", cx) + Button::new("loading-toggle-button") .label("Loading") .selected(loading), ) .child( - Button::new("selected-toggle-button", cx) + Button::new("selected-toggle-button") .label("Selected") .selected(selected), ) .child( - Button::new("compact-toggle-button", cx) + Button::new("compact-toggle-button") .label("Compact") .selected(compact), ) @@ -547,7 +547,7 @@ impl Render for ButtonStory { .child( section("Icon Button", cx) .child( - Button::new("icon-button-primary", cx) + Button::new("icon-button-primary") .icon(IconName::Search) .loading_icon(IconName::LoaderCircle) .primary() @@ -557,7 +557,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-secondary", cx) + Button::new("icon-button-secondary") .icon(IconName::Info) .loading(true) .disabled(disabled) @@ -566,7 +566,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-danger", cx) + Button::new("icon-button-danger") .icon(IconName::Close) .danger() .disabled(disabled) @@ -575,7 +575,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-small-primary", cx) + Button::new("icon-button-small-primary") .icon(IconName::Search) .small() .primary() @@ -585,7 +585,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-outline", cx) + Button::new("icon-button-outline") .icon(IconName::Search) .outline() .disabled(disabled) @@ -594,7 +594,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-ghost", cx) + Button::new("icon-button-ghost") .icon(IconName::ArrowLeft) .loading_icon(IconName::LoaderCircle) .ghost() @@ -607,7 +607,7 @@ impl Render for ButtonStory { .child( section("Icon Button", cx) .child( - Button::new("icon-button-4", cx) + Button::new("icon-button-4") .icon(IconName::Info) .small() .disabled(disabled) @@ -616,7 +616,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-5", cx) + Button::new("icon-button-5") .icon(IconName::Close) .small() .danger() @@ -626,7 +626,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-6", cx) + Button::new("icon-button-6") .icon(IconName::Search) .small() .primary() @@ -636,7 +636,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-7", cx) + Button::new("icon-button-7") .icon(IconName::Info) .xsmall() .disabled(disabled) @@ -645,7 +645,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-8", cx) + Button::new("icon-button-8") .icon(IconName::Close) .xsmall() .danger() @@ -655,7 +655,7 @@ impl Render for ButtonStory { .when(compact, |this| this.compact()), ) .child( - Button::new("icon-button-9", cx) + Button::new("icon-button-9") .icon(IconName::Heart) .size(px(24.)) .ghost() diff --git a/crates/story/src/icon_story.rs b/crates/story/src/icon_story.rs index e19e8950..4c1c6c0d 100644 --- a/crates/story/src/icon_story.rs +++ b/crates/story/src/icon_story.rs @@ -61,7 +61,7 @@ impl Render for IconStory { ) .child(Icon::new(IconName::Maximize).size(px(55.))) .child( - Button::new("like1", cx) + Button::new("like1") .icon( Icon::new(IconName::Heart) .text_color(ui::gray_500()) @@ -70,7 +70,7 @@ impl Render for IconStory { .style(ButtonStyle::Ghost), ) .child( - Button::new("like2", cx) + Button::new("like2") .icon( Icon::new(IconName::HeartOff) .text_color(ui::red_500()) diff --git a/crates/story/src/input_story.rs b/crates/story/src/input_story.rs index 49661e95..e5e3851a 100644 --- a/crates/story/src/input_story.rs +++ b/crates/story/src/input_story.rs @@ -301,14 +301,14 @@ impl Render for InputStory { .w_full() .gap_3() .child( - Button::new("btn-submit", cx) + Button::new("btn-submit") .w_full() .style(ui::button::ButtonStyle::Primary) .label("Submit") .on_click(cx.listener(|_, _, cx| cx.dispatch_action(Box::new(Tab)))), ) .child( - Button::new("btn-cancel", cx) + Button::new("btn-cancel") .w_full() .label("Cancel") .into_element(), diff --git a/crates/story/src/modal_story.rs b/crates/story/src/modal_story.rs index 15835f07..a5205c64 100644 --- a/crates/story/src/modal_story.rs +++ b/crates/story/src/modal_story.rs @@ -79,8 +79,8 @@ impl ListDelegate for ListItemDeletegate { .justify_between() .child(item.to_string()), ) - .suffix(|cx| { - Button::new("like", cx) + .suffix(|_| { + Button::new("like") .icon(IconName::Heart) .style(ButtonStyle::Ghost) .size(px(18.)) @@ -311,15 +311,12 @@ impl ModalStory { h_flex() .gap_6() .items_center() - .child( - Button::new("confirm", cx) - .primary() - .label("Confirm") - .on_click(|_, cx| { - cx.close_drawer(); - }), - ) - .child(Button::new("cancel", cx).label("Cancel").on_click(|_, cx| { + .child(Button::new("confirm").primary().label("Confirm").on_click( + |_, cx| { + cx.close_drawer(); + }, + )) + .child(Button::new("cancel").label("Cancel").on_click(|_, cx| { cx.close_drawer(); })), ) @@ -340,7 +337,7 @@ impl ModalStory { let dropdown = self.dropdown.clone(); let view = cx.view().clone(); - cx.open_modal(move |modal, cx| { + cx.open_modal(move |modal, _| { modal .title("Form Modal") .overlay(overlay) @@ -359,44 +356,37 @@ impl ModalStory { h_flex() .gap_6() .items_center() - .child( - Button::new("confirm", cx) - .primary() - .label("Confirm") - .on_click({ - let view = view.clone(); - let input1 = input1.clone(); - let date_picker = date_picker.clone(); - move |_, cx| { - cx.close_modal(); + .child(Button::new("confirm").primary().label("Confirm").on_click({ + let view = view.clone(); + let input1 = input1.clone(); + let date_picker = date_picker.clone(); + move |_, cx| { + cx.close_modal(); - view.update(cx, |view, cx| { - view.selected_value = Some( - format!( - "Hello, {}, date: {}", - input1.read(cx).text(), - date_picker.read(cx).date() - ) - .into(), - ) - }); - } - }), - ) + view.update(cx, |view, cx| { + view.selected_value = Some( + format!( + "Hello, {}, date: {}", + input1.read(cx).text(), + date_picker.read(cx).date() + ) + .into(), + ) + }); + } + })) + .child(Button::new("new-modal").label("Open Other Modal").on_click( + move |_, cx| { + cx.open_modal(move |modal, _| { + modal + .title("Other Modal") + .child("This is another modal.") + .min_h(px(300.)) + }); + }, + )) .child( - Button::new("new-modal", cx) - .label("Open Other Modal") - .on_click(move |_, cx| { - cx.open_modal(move |modal, _| { - modal - .title("Other Modal") - .child("This is another modal.") - .min_h(px(300.)) - }); - }), - ) - .child( - Button::new("cancel", cx) + Button::new("cancel") .label("Cancel") .on_click(move |_, cx| { cx.close_modal(); @@ -467,7 +457,7 @@ impl Render for ModalStory { .child("Test Focus Back") .child(self.input2.clone()) .child( - Button::new("test-action", cx) + Button::new("test-action") .label("Test Dispatch Action") .on_click(|_, cx| { cx.dispatch_action(Box::new(TestAction)); @@ -479,28 +469,28 @@ impl Render for ModalStory { .items_start() .gap_3() .child( - Button::new("show-drawer-left", cx) + Button::new("show-drawer-left") .label("Left Drawer...") .on_click(cx.listener(|this, _, cx| { this.open_drawer_at(Placement::Left, cx) })), ) .child( - Button::new("show-drawer-top", cx) + Button::new("show-drawer-top") .label("Top Drawer...") .on_click(cx.listener(|this, _, cx| { this.open_drawer_at(Placement::Top, cx) })), ) .child( - Button::new("show-drawer", cx) + Button::new("show-drawer") .label("Right Drawer...") .on_click(cx.listener(|this, _, cx| { this.open_drawer_at(Placement::Right, cx) })), ) .child( - Button::new("show-drawer", cx) + Button::new("show-drawer") .label("Bottom Drawer...") .on_click(cx.listener(|this, _, cx| { this.open_drawer_at(Placement::Bottom, cx) @@ -517,7 +507,7 @@ impl Render for ModalStory { ) }) .child( - Button::new("show-modal", cx) + Button::new("show-modal") .label("Open Modal...") .on_click(cx.listener(|this, _, cx| this.show_modal(cx))), ) @@ -525,7 +515,7 @@ impl Render for ModalStory { h_flex() .gap_3() .child( - Button::new("show-notify-info", cx) + Button::new("show-notify-info") .label("Info Notify...") .on_click(cx.listener(|_, _, cx| { cx.push_notification( @@ -534,7 +524,7 @@ impl Render for ModalStory { })), ) .child( - Button::new("show-notify-error", cx) + Button::new("show-notify-error") .label("Error Notify...") .on_click(cx.listener(|_, _, cx| { cx.push_notification(( @@ -544,7 +534,7 @@ impl Render for ModalStory { })), ) .child( - Button::new("show-notify-success", cx) + Button::new("show-notify-success") .label("Success Notify...") .on_click(cx.listener(|_, _, cx| { cx.push_notification(( @@ -554,7 +544,7 @@ impl Render for ModalStory { })), ) .child( - Button::new("show-notify-warning", cx) + Button::new("show-notify-warning") .label("Warning Notify...") .on_click(cx.listener(|_, _, cx| { struct WarningNotification; @@ -564,7 +554,7 @@ impl Render for ModalStory { })), ) .child( - Button::new("show-notify-warning", cx) + Button::new("show-notify-warning") .label("Notification with Title") .on_click(cx.listener(|_, _, cx| { struct TestNotification; diff --git a/crates/story/src/popup_story.rs b/crates/story/src/popup_story.rs index b1589f06..da4e0a9e 100644 --- a/crates/story/src/popup_story.rs +++ b/crates/story/src/popup_story.rs @@ -64,7 +64,7 @@ impl Render for Form { .child("This is a form container.") .child(self.input1.clone()) .child( - Button::new("submit", cx) + Button::new("submit") .label("Submit") .primary() .on_click(cx.listener(|_, _, cx| cx.emit(DismissEvent))), @@ -200,17 +200,17 @@ impl Render for PopupStory { .child( v_flex().gap_4().child( Popover::new("info-top-left") - .trigger(Button::new("info-top-left", cx).label("Top Left")) + .trigger(Button::new("info-top-left").label("Top Left")) .content(|cx| { cx.new_view(|cx| { - PopoverContent::new(cx, |cx| { + PopoverContent::new(cx, |_| { v_flex() .gap_4() .child("Hello, this is a Popover.") .w(px(400.)) .child(Divider::horizontal()) .child( - Button::new("info1", cx) + Button::new("info1") .label("Yes") .w(px(80.)) .small(), @@ -225,17 +225,17 @@ impl Render for PopupStory { .child( Popover::new("info-top-right") .anchor(AnchorCorner::TopRight) - .trigger(Button::new("info-top-right", cx).label("Top Right")) + .trigger(Button::new("info-top-right").label("Top Right")) .content(|cx| { cx.new_view(|cx| { - PopoverContent::new(cx, |cx| { + PopoverContent::new(cx, |_| { v_flex() .gap_4() .w_96() .child("Hello, this is a Popover on the Top Right.") .child(Divider::horizontal()) .child( - Button::new("info1", cx) + Button::new("info1") .label("Yes") .w(px(80.)) .small(), @@ -250,7 +250,7 @@ impl Render for PopupStory { h_flex() .gap_3() .child( - Button::new("popup-menu-1", cx) + Button::new("popup-menu-1") .icon(IconName::Ellipsis) .popup_menu(move |this, cx| { this.menu("Copy", Box::new(Copy)) @@ -288,20 +288,14 @@ impl Render for PopupStory { .child( Popover::new("info-bottom-left") .anchor(AnchorCorner::BottomLeft) - .trigger( - Button::new("pop", cx).label("Popup with Form").w(px(300.)), - ) + .trigger(Button::new("pop").label("Popup with Form").w(px(300.))) .content(move |_| form.clone()), ) .child( Popover::new("info-bottom-right") .anchor(AnchorCorner::BottomRight) .mouse_button(MouseButton::Right) - .trigger( - Button::new("pop", cx) - .label("Mouse Right Click") - .w(px(300.)), - ) + .trigger(Button::new("pop").label("Mouse Right Click").w(px(300.))) .content(|cx| { cx.new_view(|cx| { PopoverContent::new(cx, |cx| { @@ -315,7 +309,7 @@ impl Render for PopupStory { h_flex() .gap_4() .child( - Button::new("info1", cx) + Button::new("info1") .label("Ok") .w(px(80.)) .small() @@ -329,7 +323,7 @@ impl Render for PopupStory { )), ) .child( - Button::new("close", cx) + Button::new("close") .label("Cancel") .small() .on_click(cx.listener( diff --git a/crates/story/src/progress_story.rs b/crates/story/src/progress_story.rs index a701f31d..ea92a4f9 100644 --- a/crates/story/src/progress_story.rs +++ b/crates/story/src/progress_story.rs @@ -92,28 +92,28 @@ impl Render for ProgressStory { h_flex() .gap_x_2() .child( - Button::new("button-1", cx) + Button::new("button-1") .label("0%") .on_click(cx.listener(|this, _, _| { this.set_value(0.); })), ) .child( - Button::new("button-2", cx) + Button::new("button-2") .label("25%") .on_click(cx.listener(|this, _, _| { this.set_value(25.); })), ) .child( - Button::new("button-3", cx) + Button::new("button-3") .label("75%") .on_click(cx.listener(|this, _, _| { this.set_value(75.); })), ) .child( - Button::new("button-4", cx) + Button::new("button-4") .label("100%") .on_click(cx.listener(|this, _, _| { this.set_value(100.); @@ -125,14 +125,14 @@ impl Render for ProgressStory { h_flex() .gap_x_2() .child( - Button::new("button-5", cx) + Button::new("button-5") .icon(IconName::Minus) .on_click(cx.listener(|this, _, _| { this.set_value((this.value - 1.).max(0.)); })), ) .child( - Button::new("button-6", cx) + Button::new("button-6") .icon(IconName::Plus) .on_click(cx.listener(|this, _, _| { this.set_value((this.value + 1.).min(100.)); diff --git a/crates/story/src/scrollable_story.rs b/crates/story/src/scrollable_story.rs index 0c7de7c6..fbc5696a 100644 --- a/crates/story/src/scrollable_story.rs +++ b/crates/story/src/scrollable_story.rs @@ -93,28 +93,28 @@ impl Render for ScrollableStory { h_flex() .gap_2() .child( - Button::new("test-0", cx) + Button::new("test-0") .label("Size 0") .on_click(cx.listener(|view, _, cx| { view.change_test_cases(0, cx); })), ) .child( - Button::new("test-1", cx) + Button::new("test-1") .label("Size 1") .on_click(cx.listener(|view, _, cx| { view.change_test_cases(1, cx); })), ) .child( - Button::new("test-2", cx) + Button::new("test-2") .label("Size 2") .on_click(cx.listener(|view, _, cx| { view.change_test_cases(2, cx); })), ) .child( - Button::new("test-3", cx) + Button::new("test-3") .label("Size 3") .on_click(cx.listener(|view, _, cx| { view.change_test_cases(3, cx); @@ -122,7 +122,7 @@ impl Render for ScrollableStory { ) .child(Divider::vertical().px_2()) .child( - Button::new("test-axis-both", cx) + Button::new("test-axis-both") .label("Both Scrollbar") .on_click( cx.listener(|view, _, cx| { @@ -131,14 +131,14 @@ impl Render for ScrollableStory { ), ) .child( - Button::new("test-axis-vertical", cx) + Button::new("test-axis-vertical") .label("Vertical") .on_click(cx.listener(|view, _, cx| { view.change_axis(ScrollbarAxis::Vertical, cx) })), ) .child( - Button::new("test-axis-horizontal", cx) + Button::new("test-axis-horizontal") .label("Horizontal") .on_click(cx.listener(|view, _, cx| { view.change_axis(ScrollbarAxis::Horizontal, cx) diff --git a/crates/story/src/text_story.rs b/crates/story/src/text_story.rs index 74436c0d..eb90530e 100644 --- a/crates/story/src/text_story.rs +++ b/crates/story/src/text_story.rs @@ -117,7 +117,7 @@ impl Render for TextStory { h_flex() .child(Label::new("9,182,1 USD").text_2xl().masked(self.masked)) .child( - Button::new("btn-mask", cx) + Button::new("btn-mask") .style(ButtonStyle::Ghost) .icon(if self.masked { IconName::EyeOff diff --git a/crates/story/src/tooltip_story.rs b/crates/story/src/tooltip_story.rs index 4ab69ccb..bf2ce38f 100644 --- a/crates/story/src/tooltip_story.rs +++ b/crates/story/src/tooltip_story.rs @@ -47,7 +47,7 @@ impl gpui::FocusableView for TooltipStory { } } impl Render for TooltipStory { - fn render(&mut self, cx: &mut gpui::ViewContext) -> impl gpui::IntoElement { + fn render(&mut self, _: &mut gpui::ViewContext) -> impl gpui::IntoElement { v_flex() .p_4() .gap_5() @@ -55,7 +55,7 @@ impl Render for TooltipStory { div() .cursor(CursorStyle::PointingHand) .child( - Button::new("button", cx) + Button::new("button") .label("Hover me") .style(ButtonStyle::Primary), ) diff --git a/crates/story/src/webview_story.rs b/crates/story/src/webview_story.rs index 5ad13fac..171041f4 100644 --- a/crates/story/src/webview_story.rs +++ b/crates/story/src/webview_story.rs @@ -103,7 +103,7 @@ impl Render for WebViewStory { .gap_2() .items_center() .child( - Button::new("go-back", cx) + Button::new("go-back") .icon(IconName::ArrowLeft) .on_click(cx.listener(Self::go_back)), ) diff --git a/crates/ui/src/button.rs b/crates/ui/src/button.rs index f13ff9a4..572805ec 100644 --- a/crates/ui/src/button.rs +++ b/crates/ui/src/button.rs @@ -7,8 +7,8 @@ use crate::{ }; use gpui::{ div, prelude::FluentBuilder as _, px, relative, AnyElement, ClickEvent, Corners, Div, Edges, - ElementId, FocusHandle, Hsla, InteractiveElement, IntoElement, MouseButton, ParentElement, - Pixels, RenderOnce, SharedString, StatefulInteractiveElement as _, Styled, WindowContext, + ElementId, Hsla, InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, + RenderOnce, SharedString, StatefulInteractiveElement as _, Styled, WindowContext, }; pub enum ButtonRounded { @@ -147,7 +147,6 @@ impl ButtonStyle { pub struct Button { pub base: Div, id: ElementId, - focus_handle: FocusHandle, icon: Option, label: Option, children: Vec, @@ -173,10 +172,9 @@ impl From