From 2b134e47a13e58048d4cdc07ceb15011dc4596a0 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 27 Sep 2024 20:28:57 +0800 Subject: [PATCH] button: Reduce gap between icon and label for small, xsmall button. (#285) --- crates/story/src/button_story.rs | 2 ++ crates/ui/src/button.rs | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/story/src/button_story.rs b/crates/story/src/button_story.rs index bda8490f..c44d3dab 100644 --- a/crates/story/src/button_story.rs +++ b/crates/story/src/button_story.rs @@ -332,6 +332,7 @@ impl Render for ButtonStory { .child( Button::new("button-6") .label("Primary Button") + .icon(IconName::Check) .primary() .small() .loading(true) @@ -402,6 +403,7 @@ impl Render for ButtonStory { Button::new("button-xs-1") .label("Primary Button") .primary() + .icon(IconName::Check) .xsmall() .disabled(disabled) .selected(selected) diff --git a/crates/ui/src/button.rs b/crates/ui/src/button.rs index 572805ec..5c0e0173 100644 --- a/crates/ui/src/button.rs +++ b/crates/ui/src/button.rs @@ -425,11 +425,10 @@ impl RenderOnce for Button { .id("label") .items_center() .justify_center() - .gap_2() .map(|this| match self.size { - Size::XSmall => this.text_xs(), - Size::Small => this.text_sm(), - _ => this.text_base(), + Size::XSmall => this.gap_1().text_xs(), + Size::Small => this.gap_1().text_sm(), + _ => this.gap_2().text_base(), }) .when(!self.loading, |this| { this.when_some(self.icon, |this, icon| {