ant-design/components/steps/style/index.less
Thibault Derousseaux 43abea3212 Use tabular-nums font variant instead of switching to Tahoma for figures
Using a completely different font for figures leads to inconsistencies: https://github.com/ant-design/ant-design/issues/9422.
Most modern font systems defaults to [tabular figures](https://www.fonts.com/content/learning/fontology/level-3/numbers/proportional-vs-tabular-figures).
One exception to this is Apple's San Francisco which defaults to [proportional figures](http://martiancraft.com/blog/2015/10/san-francisco-part-2/#special-features-numerals).
There is, however, an official and clean way to switch to tabular figures. It's the [`font-variant` CSS property](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric) that can be set to `tabular-nums`.

This commit removes the "Monospaced Number" font altogether and use `font-variant: tabular-nums` instead where it was used.
It also moves closer to the sans-serif and monospace [system font stacks used by GitHub](http://markdotto.com/2018/02/07/github-system-fonts/).
2018-08-04 11:28:14 +08:00

188 lines
4.2 KiB
Plaintext

@import "../../style/themes/default";
@import "../../style/mixins/index";
@steps-prefix-cls: ~"@{ant-prefix}-steps";
@process-icon-color: @primary-color;
@process-title-color: @heading-color;
@process-description-color: @text-color;
@process-tail-color: @border-color-split;
@process-icon-text-color: #fff;
@wait-icon-color: @disabled-color;
@wait-title-color: @text-color-secondary;
@wait-description-color: @wait-title-color;
@wait-tail-color: @process-tail-color;
@finish-icon-color: @process-icon-color;
@finish-title-color: @text-color;
@finish-description-color: @text-color-secondary;
@finish-tail-color: @primary-color;
@error-icon-color: @error-color;
@error-title-color: @error-color;
@error-description-color: @error-color;
@error-tail-color: @wait-tail-color;
@steps-background: @component-background;
@steps-icon-size: 32px;
@steps-small-icon-size: 24px;
@steps-dot-size: 8px;
@steps-current-dot-size: 10px;
@steps-desciption-max-width: 140px;
.@{steps-prefix-cls} {
.reset-component;
font-size: 0;
width: 100%;
display: flex;
}
.@{steps-prefix-cls}-item {
position: relative;
display: inline-block;
vertical-align: top;
flex: 1;
overflow: hidden;
&:last-child {
flex: none;
}
&:last-child &-tail,
&:last-child &-title:after {
display: none;
}
&-icon,
&-content {
display: inline-block;
vertical-align: top;
}
&-icon {
border: @border-width-base @border-style-base @wait-icon-color;
width: @steps-icon-size;
height: @steps-icon-size;
line-height: @steps-icon-size;
text-align: center;
border-radius: @steps-icon-size;
font-size: @font-size-lg;
margin-right: 8px;
transition: background-color .3s, border-color .3s;
font-family: @font-family;
> .@{steps-prefix-cls}-icon {
line-height: 1;
top: -1px;
color: @primary-color;
position: relative;
}
}
&-tail {
position: absolute;
left: 0;
width: 100%;
top: 12px;
padding: 0 10px;
&:after {
content: '';
display: inline-block;
background: @border-color-split;
height: 1px;
border-radius: 1px;
width: 100%;
transition: background .3s;
}
}
&-title {
font-size: @font-size-lg;
color: @text-color;
display: inline-block;
padding-right: 16px;
position: relative;
line-height: @steps-icon-size;
&:after {
content: '';
height: 1px;
width: 9999px;
background: @wait-tail-color;
display: block;
position: absolute;
top: @steps-icon-size / 2;
left: 100%;
}
}
&-description {
font-size: @font-size-base;
color: @text-color-secondary;
}
.step-item-status(wait);
.step-item-status(process);
&-process &-icon {
background: @process-icon-color;
> .@{steps-prefix-cls}-icon {
color: @process-icon-text-color;
}
}
&-process &-title {
font-weight: 500;
}
.step-item-status(finish);
.step-item-status(error);
&.@{steps-prefix-cls}-next-error .@{steps-prefix-cls}-item-title:after {
background: @error-icon-color;
}
}
.@{steps-prefix-cls}-horizontal:not(.@{steps-prefix-cls}-label-vertical) {
.@{steps-prefix-cls}-item {
margin-right: 16px;
white-space: nowrap;
&:last-child {
margin-right: 0;
}
&:last-child .@{steps-prefix-cls}-item-title {
padding-right: 0;
}
&-tail {
display: none;
}
&-description {
max-width: @steps-desciption-max-width;
}
}
}
.step-item-status(@status) {
@icon-color: "@{status}-icon-color";
@title-color: "@{status}-title-color";
@description-color: "@{status}-description-color";
@tail-color: "@{status}-tail-color";
&-@{status} &-icon {
border-color: @@icon-color;
background-color: @steps-background;
> .@{steps-prefix-cls}-icon {
color: @@icon-color;
.@{steps-prefix-cls}-icon-dot {
background: @@icon-color;
}
}
}
&-@{status} > &-content > &-title {
color: @@title-color;
&:after {
background-color: @@tail-color;
}
}
&-@{status} > &-content > &-description {
color: @@description-color;
}
&-@{status} > &-tail:after {
background-color: @@tail-color;
}
}
@import 'custom-icon';
@import 'small';
@import 'vertical';
@import 'label-placement';
@import 'progress-dot';