Skip to content

Commit 7e69fb2

Browse files
Small mm-tabs tweak
- fix example - make icon look nicer on tab
1 parent f20315e commit 7e69fb2

4 files changed

Lines changed: 46 additions & 6 deletions

File tree

src/mm-tab/mm-tab.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
type: String,
2121
value: ''
2222
},
23+
iconWidth: {
24+
type: Number,
25+
value: 13
26+
},
27+
iconHeight: {
28+
type: Number,
29+
value: 13
30+
},
2331
tabLabel: {
2432
type: String,
2533
value: '',

src/mm-tabs/example.html

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1+
<style type="text/css">
2+
.tab-content {
3+
box-sizing: border-box;
4+
padding: 15px;
5+
}
6+
</style>
7+
18
<mm-tabs tab-bar-offset="15">
2-
<mm-tab tab-label="First" icon="info" active>This is the first tab content.</mm-tab>
3-
<mm-tab tab-label="Second"><template>This is the second tab content.</template></mm-tab>
4-
<mm-tab tab-label="Third"><template>This is the third tab content.</template></mm-tab>
9+
<mm-tab tab-label="First" icon="info" active>
10+
<div class="tab-content">
11+
<p>This is the first tab content.</p>
12+
</div>
13+
</mm-tab>
14+
<mm-tab tab-label="Second">
15+
<div class="tab-content">
16+
<p>This is the second tab content.</p>
17+
</div>
18+
</mm-tab>
19+
<mm-tab tab-label="Third">
20+
<div class="tab-content">
21+
<p>This is the third tab content.</p>
22+
</div>
23+
</mm-tab>
524
</mm-tabs>

src/mm-tabs/mm-tabs.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
<ul id="tabBar" class$="{{tabBarPosition}}" style$="{{_updateStyle(tabBarPosition,tabBarOffset)}}">
2121
<template id="tabList" is="dom-repeat" items="{{_tabs}}">
2222
<li active$="{{item.active}}" on-tap="_handleTap">
23-
<template is="dom-if" if="{{item.icon}}"><mm-icon type="{{item.icon}}" height="16" width="16"></mm-icon></template>
23+
<template is="dom-if" if="{{item.icon}}">
24+
<mm-icon type="{{item.icon}}" height="{{item.iconHeight}}" width="{{item.iconWidth}}"></mm-icon>
25+
</template>
2426
<span>{{item.tabLabel}}</span>
2527
</li>
2628
</template>

src/mm-tabs/mm-tabs.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
color: $color-A5;
3434
cursor: pointer;
3535
list-style-type: none;
36+
37+
mm-icon {
38+
margin-right: 5px;
39+
}
3640
}
3741

3842
li[active] {
@@ -52,6 +56,10 @@
5256
border-top-right-radius: 3px;
5357
margin: 0 -1px 0 0;
5458
padding: .5em 1em .25em;
59+
60+
mm-icon {
61+
margin-right: 5px;
62+
}
5563
}
5664

5765
li[active] {
@@ -93,8 +101,7 @@
93101
}
94102
}
95103

96-
#tabBar.left ~ ::content > mm-tab, // shadow
97-
::content #tabBar.left ~ mm-tab { // shady
104+
#tabBar.left > ::content > mm-tab {
98105
border-left: 1px solid darken($color-A12, 10%);
99106
}
100107

@@ -108,6 +115,10 @@
108115
border-radius: 0;
109116
border-image: linear-gradient(to bottom, transparent, $color-A20) 1 100%;
110117
padding: .75em 1em .5em;
118+
119+
mm-icon {
120+
margin-right: 5px;
121+
}
111122
}
112123

113124
li[active] {

0 commit comments

Comments
 (0)