Skip to content

Commit ccbd783

Browse files
committed
WIP: update tabs component
1 parent a255850 commit ccbd783

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

src/molecules/tabs/Tabs.html

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
:key="`${tab.id}-tab-trigger`"
88
:id="`${tab.id}-tab-trigger`"
99
:aria-controls="`${tab.id}-tab`"
10-
:aria-selected="tab.isActive || 'false'"
11-
:aria-expanded="tab.isActive || 'false'"
10+
:aria-selected="`${tab.isActive}`"
11+
:aria-expanded="`${tab.isActive}`"
1212
type="button"
1313
role="tab"
1414
:ref="`button_${i}`"
@@ -21,20 +21,24 @@
2121
name="button"
2222
:tab="tab"
2323
>
24-
{{ tab.name }}
24+
<span class="">
25+
{{ tab.name }}
26+
</span>
2527
</slot>
2628
<!-- @slot Custom accordion tab icon (Named slot) -->
2729
<slot name="icon">
28-
30+
<a-icon :class="getClass(tab.isActive ? 'tabs__nav-icon--active' : 'tabs__nav-icon')">
31+
<a-icon-expand-more />
32+
</a-icon>
2933
</slot>
3034
</button>
3135
<div
3236
ref="content"
33-
class="a-tabs__content"
3437
:class="getClass('tabs__content')"
38+
role="tabpanel"
3539
tabindex="-1"
3640
>
3741
<!-- @slot Tab components -->
38-
<slot/>
42+
<slot />
3943
</div>
4044
</div>

src/molecules/tabs/Tabs.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,27 @@ export default {
1010
config: {
1111
base: {
1212
tabs: [
13-
'lg:flex', 'lg:flex-wrap', 'justify-center'
13+
'flex', 'flex-wrap'
1414
],
1515
'tabs__nav-button': [
16-
'text-gray-600', 'py-4', 'px-6', 'block', 'hover:text-blue-500'
16+
'relative',
17+
'flex', 'w-full', 'items-center',
18+
'text-gray-600', 'py-4', 'px-6', 'hover:text-blue-500'
1719
],
1820
'tabs__nav-button--active': [
19-
'text-gray-600', 'py-4', 'px-6', 'block', 'hover:text-blue-500', 'text-blue-500', 'border-b-2', 'font-medium', 'border-blue-500'
21+
'relative',
22+
'flex', 'w-full', 'items-center',
23+
'py-4', 'px-6',
24+
'text-gray-600', 'hover:text-blue-500', 'text-blue-500', 'border-b-2', 'font-medium', 'border-blue-500'
25+
],
26+
'tabs__nav-icon': [
27+
'relative',
28+
'ml-auto'
29+
],
30+
'tabs__nav-icon--active': [
31+
'relative',
32+
'ml-auto',
33+
'transform rotate-180'
2034
],
2135
tabs__content: [
2236
'py-4'

src/molecules/tabs/Tabs.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
<script>
44
import ATabs from './Tabs.js'
55
6-
import AButton from '../../atoms/button/Button.vue'
6+
import AButton from '@atoms/button/Button.vue'
7+
import AIcon from '@atoms/icon/Icon.vue'
8+
import AIconExpandMore from '@atoms/icon/templates/IconExpandMore.vue'
79
810
export default {
9-
components: { AButton },
11+
components: {
12+
AButton,
13+
AIcon,
14+
AIconExpandMore
15+
},
1016
mixins: [ATabs]
1117
}
1218
</script>

0 commit comments

Comments
 (0)