button: Reduce px for compact small button. (#271)

<img width="882" alt="image"
src="https://github.com/user-attachments/assets/c41955ea-5126-4d1a-b2dd-dea2e4b89c9e">
This commit is contained in:
Jason Lee 2024-09-25 21:48:44 +08:00 committed by GitHub
parent 2d6f478512
commit 098315ee92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -402,7 +402,7 @@ impl Render for ButtonStory {
Button::new("button-xs-1", cx)
.label("Primary Button")
.primary()
.small()
.xsmall()
.disabled(disabled)
.selected(selected)
.loading(loading)

View file

@ -342,7 +342,7 @@ impl RenderOnce for Button {
match self.size {
Size::Size(size) => this.px(size * 0.2),
Size::XSmall => this.h_5().px_1(),
Size::Small => this.h_6().px_3().when(self.compact, |this| this.px_2()),
Size::Small => this.h_6().px_3().when(self.compact, |this| this.px_1p5()),
_ => this.h_8().px_4().when(self.compact, |this| this.px_2()),
}
}