Skip to content

Commit

Permalink
button: Fix Button text vertical center.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Sep 27, 2024
1 parent 26d9583 commit a2af83e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
1 change: 1 addition & 0 deletions crates/app/src/story_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ impl Render for StoryWorkspace {
let notifications_count = cx.notifications().len();

div()
.font_family(".SystemUIFont")
.relative()
.size_full()
.flex()
Expand Down
15 changes: 1 addition & 14 deletions crates/ui/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,6 @@ impl RenderOnce for Button {
_ => self.size,
};

// Hotfix the font vertical center for macOS.
let text_offset_top = if cfg!(target_os = "windows") {
px(0.)
} else {
px(2.)
};

self.base
.id(self.id)
.flex()
Expand Down Expand Up @@ -443,13 +436,7 @@ impl RenderOnce for Button {
)
})
.when_some(self.label, |this, label| {
this.child(
div()
.flex_none()
// .mt(text_offset_top)
.line_height(relative(1.))
.child(label),
)
this.child(div().flex_none().line_height(relative(1.)).child(label))
})
.children(self.children)
})
Expand Down

0 comments on commit a2af83e

Please sign in to comment.