tab: Fix tab text vertical center in small, xsmall size. (#1097)
This commit is contained in:
parent
461ed9c173
commit
058dd27687
1 changed files with 6 additions and 6 deletions
|
|
@ -3,9 +3,9 @@ use std::sync::Arc;
|
||||||
use crate::{h_flex, ActiveTheme, Icon, IconName, Selectable, Sizable, Size, StyledExt};
|
use crate::{h_flex, ActiveTheme, Icon, IconName, Selectable, Sizable, Size, StyledExt};
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
div, px, AnyElement, App, ClickEvent, Div, Edges, ElementId, Hsla, InteractiveElement,
|
div, px, relative, AnyElement, App, ClickEvent, Div, Edges, ElementId, Hsla,
|
||||||
IntoElement, ParentElement, Pixels, RenderOnce, SharedString, StatefulInteractiveElement,
|
InteractiveElement, IntoElement, ParentElement, Pixels, RenderOnce, SharedString,
|
||||||
Styled, Window,
|
StatefulInteractiveElement, Styled, Window,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Default, Copy, PartialEq, Eq, Hash)]
|
||||||
|
|
@ -67,12 +67,12 @@ impl TabVariant {
|
||||||
fn inner_height(&self, size: Size) -> Pixels {
|
fn inner_height(&self, size: Size) -> Pixels {
|
||||||
match size {
|
match size {
|
||||||
Size::XSmall => match self {
|
Size::XSmall => match self {
|
||||||
TabVariant::Tab | TabVariant::Outline | TabVariant::Pill => px(20.),
|
TabVariant::Tab | TabVariant::Outline | TabVariant::Pill => px(18.),
|
||||||
TabVariant::Segmented => px(16.),
|
TabVariant::Segmented => px(16.),
|
||||||
TabVariant::Underline => px(20.),
|
TabVariant::Underline => px(20.),
|
||||||
},
|
},
|
||||||
Size::Small => match self {
|
Size::Small => match self {
|
||||||
TabVariant::Tab | TabVariant::Outline | TabVariant::Pill => px(24.),
|
TabVariant::Tab | TabVariant::Outline | TabVariant::Pill => px(22.),
|
||||||
TabVariant::Segmented => px(20.),
|
TabVariant::Segmented => px(20.),
|
||||||
TabVariant::Underline => px(22.),
|
TabVariant::Underline => px(22.),
|
||||||
},
|
},
|
||||||
|
|
@ -620,7 +620,7 @@ impl RenderOnce for Tab {
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.h(inner_height)
|
.h(inner_height)
|
||||||
.line_height(inner_height)
|
.line_height(relative(1.))
|
||||||
.items_center()
|
.items_center()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
.overflow_hidden()
|
.overflow_hidden()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue