switch: Fix switch label to vertical center. (#710)

<img width="775" alt="image"
src="https://github.com/user-attachments/assets/c004e552-c161-4e09-9543-13727382204b"
/>
This commit is contained in:
Jason Lee 2025-03-11 20:55:58 +08:00 committed by GitHub
parent c2dddf6f55
commit d0abcb2456
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -203,9 +203,11 @@ impl Element for Switch {
), ),
) )
.when_some(self.label.take(), |this, label| { .when_some(self.label.take(), |this, label| {
this.child(div().child(label).map(|this| match self.size { this.child(div().line_height(bg_height).child(label).map(|this| {
Size::XSmall | Size::Small => this.text_sm(), match self.size {
_ => this.text_base(), Size::XSmall | Size::Small => this.text_sm(),
_ => this.text_base(),
}
})) }))
}) })
.when_some( .when_some(