Skip to content

Commit 6e3e07b

Browse files
committed
fix(all): improve text customization
1 parent 4ec038d commit 6e3e07b

File tree

11 files changed

+44
-76
lines changed

11 files changed

+44
-76
lines changed

angular/BREAKING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ presentPopover(ev: any) {
954954
async presentPopover(ev: any) {
955955
const popover = await this.popoverController.create({
956956
component: PopoverComponent,
957-
ev: event,
957+
event: event,
958958
translucent: true
959959
});
960960
return await popover.present();

core/src/components/back-button/back-button.scss

+9-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
color: #{current-color(base)};
1010
pointer-events: all;
11+
12+
text-align: center;
13+
text-decoration: none;
14+
text-overflow: ellipsis;
15+
text-transform: none;
16+
17+
white-space: nowrap;
18+
font-kerning: none;
1119
}
1220

1321
:host-context(.can-go-back > ion-header),
@@ -16,6 +24,7 @@
1624
}
1725

1826
.back-button-native {
27+
@include text-inherit();
1928
@include font-smoothing();
2029

2130
display: block;
@@ -27,21 +36,11 @@
2736

2837
outline: none;
2938

30-
color: inherit;
31-
3239
line-height: 1;
3340

34-
text-align: center;
35-
text-decoration: none;
36-
text-overflow: ellipsis;
37-
text-transform: none;
38-
39-
white-space: nowrap;
40-
4141
cursor: pointer;
4242
user-select: none;
4343
z-index: 0;
44-
font-kerning: none;
4544
appearance: none;
4645
}
4746

core/src/components/button/button.scss

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
user-select: none;
2222
vertical-align: top; // the better option for most scenarios
2323
vertical-align: -webkit-baseline-middle; // the best for those that support it
24+
25+
font-kerning: none;
2426
}
2527

2628
:host([disabled]) {
@@ -123,7 +125,6 @@
123125

124126
transition: var(--transition);
125127

126-
127128
border-width: var(--border-width);
128129
border-style: var(--border-style);
129130
border-color: var(--border-color);
@@ -139,11 +140,9 @@
139140
cursor: pointer;
140141
opacity: var(--opacity);
141142
overflow: var(--overflow);
142-
vertical-align: top; // the better option for most scenarios
143-
vertical-align: -webkit-baseline-middle; // the best for those that support it
143+
144144
z-index: 0;
145145
box-sizing: border-box;
146-
font-kerning: none;
147146
appearance: none;
148147
}
149148

core/src/components/fab-button/fab-button.scss

+8-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
color: #{current-color(contrast)};
1919

2020
font-size: 14px;
21+
22+
text-align: center;
23+
text-overflow: ellipsis;
24+
text-transform: none;
25+
26+
white-space: nowrap;
27+
font-kerning: none;
2128
}
2229

2330

@@ -26,6 +33,7 @@
2633
}
2734

2835
.fab-button-native {
36+
@include text-inherit();
2937
@include border-radius(50%);
3038
@include margin(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
3139

@@ -45,25 +53,14 @@
4553

4654
background: var(--background);
4755
background-clip: padding-box;
48-
color: inherit;
49-
50-
font-size: inherit;
51-
font-weight: inherit;
5256

5357
line-height: var(--size);
5458

55-
text-align: center;
56-
text-overflow: ellipsis;
57-
text-transform: none;
58-
59-
white-space: nowrap;
60-
6159
box-shadow: var(--box-shadow);
6260
contain: strict;
6361
cursor: pointer;
6462
overflow: hidden;
6563
z-index: 0;
66-
font-kerning: none;
6764
appearance: none;
6865
}
6966

@@ -86,8 +83,6 @@
8683
flex-flow: row nowrap;
8784
flex-shrink: 0;
8885
align-items: center;
89-
align-items: center;
90-
justify-content: center;
9186
justify-content: center;
9287

9388
height: 100%;

core/src/components/menu-button/menu-button.scss

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@
77
pointer-events: all;
88

99
color: #{current-color(base)};
10+
11+
text-align: center;
12+
text-decoration: none;
13+
text-overflow: ellipsis;
14+
text-transform: none;
15+
16+
white-space: nowrap;
17+
font-kerning: none;
1018
}
1119

1220
button {
21+
@include text-inherit();
1322
@include margin(0);
1423
@include padding(0);
1524
@include font-smoothing();
@@ -30,21 +39,12 @@ button {
3039
outline: none;
3140

3241
background: transparent;
33-
color: inherit;
3442

3543
line-height: 1;
3644

37-
text-align: center;
38-
text-decoration: none;
39-
text-overflow: ellipsis;
40-
text-transform: none;
41-
42-
white-space: nowrap;
43-
4445
cursor: pointer;
4546
user-select: none;
4647
z-index: 0;
47-
font-kerning: none;
4848
appearance: none;
4949
}
5050

core/src/components/segment-button/segment-button.scss

+7-12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
--icon-size: 1em;
1212

1313
flex: 1;
14+
15+
text-decoration: none;
16+
text-overflow: ellipsis;
17+
18+
white-space: nowrap;
19+
font-kerning: none;
1420
}
1521

1622
:host(:first-of-type) .segment-button-native {
@@ -30,6 +36,7 @@
3036
}
3137

3238
.segment-button-native {
39+
@include text-inherit();
3340
@include margin(var(--margin-top), var(--margin-end), var(--margin-bottom), var(--margin-start));
3441
@include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
3542

@@ -46,22 +53,10 @@
4653
border-color: var(--border-color);
4754

4855
background: var(--background);
49-
color: inherit;
50-
51-
font-size: inherit;
52-
font-weight: inherit;
53-
54-
text-align: center;
55-
text-decoration: none;
56-
text-overflow: ellipsis;
57-
text-transform: inherit;
58-
59-
white-space: nowrap;
6056

6157
contain: content;
6258
cursor: pointer;
6359
overflow: hidden;
64-
font-kerning: none;
6560

6661
&:active,
6762
&:focus {

core/src/components/textarea/textarea.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@
3636
box-sizing: border-box;
3737

3838
background: var(--background);
39+
color: var(--color);
3940
}
4041

4142
:host(.ion-color) {
4243
background: initial;
4344
}
4445

45-
:host(.ion-color) .native-textarea {
46+
:host(.ion-color) {
4647
color: current-color(base);
4748
}
4849

@@ -73,7 +74,6 @@
7374
outline: none;
7475

7576
background: transparent;
76-
color: var(--color);
7777

7878
box-sizing: border-box;
7979
resize: none;

core/src/components/toast/toast.ios.scss

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
--color: #{$toast-ios-title-color};
1111

1212
font-family: $toast-ios-font-family;
13+
font-size: $toast-ios-title-font-size;
1314
}
1415

1516
.toast-ios .toast-wrapper {
@@ -48,10 +49,6 @@
4849

4950
.toast-ios .toast-message {
5051
@include padding($toast-ios-title-padding-top, $toast-ios-title-padding-end, $toast-ios-title-padding-bottom, $toast-ios-title-padding-start);
51-
52-
color: var(--color);
53-
54-
font-size: $toast-ios-title-font-size;
5552
}
5653

5754
.toast-ios .toast-button {

core/src/components/toast/toast.md.scss

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
.toast-md {
88
--background: #{$toast-md-background};
9-
--color: #{toast-md-title-color};
9+
--color: #{$toast-md-title-color};
1010

1111
font-family: $toast-md-font-family;
12+
font-size: $toast-md-title-font-size;
1213
}
1314

1415
.toast-md .toast-wrapper {
@@ -42,8 +43,4 @@
4243

4344
.toast-md .toast-message {
4445
@include padding($toast-md-title-padding-top, $toast-md-title-padding-end, $toast-md-title-padding-bottom, $toast-md-title-padding-start);
45-
46-
color: var(--color);
47-
48-
font-size: $toast-md-title-font-size;
4946
}

core/src/components/toast/toast.scss

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ion-toast {
1818
width: $toast-width;
1919
height: $toast-width;
2020

21+
color: var(--color);
22+
2123
contain: strict;
2224
z-index: $z-index-overlay;
2325
pointer-events: none;

core/src/themes/ionic.mixins.scss

-16
Original file line numberDiff line numberDiff line change
@@ -361,22 +361,6 @@
361361
}
362362
}
363363

364-
// Sets correct text align with support for old browsers
365-
// @param {string} $direction - text direction
366-
// @param {string} $decorator - !important
367-
// ----------------------------------------------------------
368-
@mixin text-align($direction, $decorator: null) {
369-
@if $direction == start {
370-
text-align: left;
371-
text-align: start $decorator;
372-
} @else if $direction == end {
373-
text-align: right;
374-
text-align: end $decorator;
375-
} @else {
376-
text-align: $direction $decorator;
377-
}
378-
}
379-
380364
// Add direction for all directions
381365
// @param {string} $dir - Direction on LTR
382366
@mixin direction($dir) {

0 commit comments

Comments
 (0)