Skip to content

Commit eea7e6b

Browse files
committed
feat(tabs): add the transition for material design tabs
refactored the sass naming to use `text-capitalization` instead of `text-transform` since it now has an actual `transform` property and I think this will be less confusing than having a `text-text-transform` and a `text-transform`. references #7455
1 parent 8bf1a35 commit eea7e6b

File tree

1 file changed

+44
-23
lines changed

1 file changed

+44
-23
lines changed

src/components/tabs/tabs.md.scss

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,58 @@
55
// --------------------------------------------------
66

77
// Background color of the tabbar
8-
$tabs-md-background: $toolbar-md-background !default;
8+
$tabs-md-background: $toolbar-md-background !default;
99

1010
// Padding on the tab button
11-
$tabs-md-tab-padding: 8px 0 10px 0 !default;
11+
$tabs-md-tab-padding: 8px 0 10px 0 !default;
1212

1313
// Min height of the tab button
14-
$tabs-md-tab-min-height: 5.6rem !default;
14+
$tabs-md-tab-min-height: 5.6rem !default;
1515

1616
// Font size of the inactive tab button text
17-
$tabs-md-tab-font-size: 1.4rem !default;
17+
$tabs-md-tab-font-size: 1.2rem !default;
1818

1919
// Font weight of the tab button text
20-
$tabs-md-tab-font-weight: normal !default;
20+
$tabs-md-tab-font-weight: normal !default;
2121

2222
// Opacity of the inactive tab button
23-
$tabs-md-tab-opacity: .7 !default;
23+
$tabs-md-tab-opacity: .7 !default;
2424

2525
// Text color of the inactive tab button
26-
$tabs-md-tab-color: rgba($toolbar-md-inactive-color, $tabs-md-tab-opacity) !default;
26+
$tabs-md-tab-color: rgba($toolbar-md-inactive-color, $tabs-md-tab-opacity) !default;
2727

2828
// Padding of the active tab button
29-
$tabs-md-tab-padding-active: 6px 0 10px 0 !default;
29+
$tabs-md-tab-padding-active: 6px 0 10px 0 !default;
3030

3131
// Font size of the active tab button text
32-
$tabs-md-tab-font-size-active: 1.5rem !default;
32+
$tabs-md-tab-font-size-active: 1.4rem !default;
3333

3434
// Text color of the active tab button
35-
$tabs-md-tab-color-active: $toolbar-md-active-color !default;
35+
$tabs-md-tab-color-active: $toolbar-md-active-color !default;
3636

3737
// Margin on the tab button text
38-
$tabs-md-tab-text-margin: 6px 0 !default;
38+
$tabs-md-tab-text-margin: 6px 0 !default;
3939

40-
// Text transformation for the tab button text
41-
$tabs-md-tab-text-transform: none !default;
40+
// Capitalization of the tab button text
41+
$tabs-md-tab-text-capitalization: none !default;
42+
43+
// Transform for the tab button text
44+
$tabs-md-tab-text-transform: scale(.85) !default;
45+
46+
// Transform origin for the tab button text
47+
$tabs-md-tab-text-transform-origin: bottom center !default;
48+
49+
// Margin on the active tab button text
50+
$tabs-md-tab-text-margin-active: 7px 0 !default;
51+
52+
// Transform for the active tab button text
53+
$tabs-md-tab-text-transform-active: scale(1) !default;
54+
55+
// Text transition for the tab button text
56+
$tabs-md-tab-text-transition: transform 200ms ease-in-out !default;
4257

4358
// Size of the tab button icon
44-
$tabs-md-tab-icon-size: 2.4rem !default;
59+
$tabs-md-tab-icon-size: 2.4rem !default;
4560

4661

4762
ion-tabbar {
@@ -53,7 +68,6 @@ ion-tabbar {
5368

5469
min-height: $tabs-md-tab-min-height;
5570

56-
font-size: $tabs-md-tab-font-size;
5771
font-weight: $tabs-md-tab-font-weight;
5872
color: $tabs-md-tab-color;
5973

@@ -68,7 +82,16 @@ ion-tabbar {
6882
.tab-button-text {
6983
margin: $tabs-md-tab-text-margin;
7084

71-
text-transform: $tabs-md-tab-text-transform;
85+
text-transform: $tabs-md-tab-text-capitalization;
86+
transform: $tabs-md-tab-text-transform;
87+
transform-origin: $tabs-md-tab-text-transform-origin;
88+
89+
transition: $tabs-md-tab-text-transition;
90+
}
91+
92+
.tab-button[aria-selected=true] .tab-button-text {
93+
margin: $tabs-md-tab-text-margin-active;
94+
transform: $tabs-md-tab-text-transform-active;
7295
}
7396

7497
.tab-button-icon {
@@ -77,20 +100,18 @@ ion-tabbar {
77100
font-size: $tabs-md-tab-icon-size;
78101
}
79102

80-
[tabsLayout=icon-top] {
81-
.has-icon .tab-button-text {
82-
margin-bottom: 0;
83-
}
103+
[tabsLayout=icon-top] .has-icon .tab-button-text {
104+
margin-bottom: 0;
84105
}
85106

86107
[tabsLayout=icon-bottom] {
87108
.tab-button {
88109
padding-top: 8px;
89110
padding-bottom: 8px;
90-
}
91111

92-
.tab-button-text {
93-
margin-top: 0;
112+
.tab-button-text {
113+
margin-top: 0;
114+
}
94115
}
95116
}
96117

0 commit comments

Comments
 (0)