2019-05-04 17:58:44 -07:00
|
|
|
<nav aria-label={label} class={className}>
|
|
|
|
<ul>
|
|
|
|
{#each tabs as tab (tab.name)}
|
|
|
|
<li class="{currentTabName === tab.name ? 'current' : 'not-current'}">
|
2020-11-29 14:13:27 -08:00
|
|
|
<a aria-label={createAriaLabel(tab.label, tab.name, currentTabName)}
|
|
|
|
aria-current={tab.name === currentTabName}
|
2019-09-24 00:50:35 -07:00
|
|
|
class="focus-fix"
|
2019-05-04 17:58:44 -07:00
|
|
|
href={tab.href}
|
|
|
|
rel="prefetch">
|
|
|
|
{tab.label}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{/each}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
<style>
|
|
|
|
li {
|
|
|
|
flex: 1;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* reset */
|
|
|
|
ul, li {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul {
|
|
|
|
list-style: none;
|
|
|
|
display: flex;
|
2019-05-05 12:30:08 -07:00
|
|
|
margin: 0;
|
2019-05-04 17:58:44 -07:00
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
|
|
|
|
li {
|
|
|
|
border: 1px solid var(--main-border);
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2019-05-05 12:30:08 -07:00
|
|
|
border-top-left-radius: 7px;
|
|
|
|
border-top-right-radius: 7px;
|
2019-05-04 17:58:44 -07:00
|
|
|
background: var(--tab-bg);
|
2019-05-05 12:30:08 -07:00
|
|
|
border-left: none;
|
2019-05-04 17:58:44 -07:00
|
|
|
}
|
|
|
|
|
2019-05-05 12:30:08 -07:00
|
|
|
li:last-child {
|
|
|
|
border-right: none;
|
2019-05-04 17:58:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
li:hover {
|
|
|
|
background: var(--button-bg-hover);
|
|
|
|
}
|
|
|
|
|
|
|
|
li.not-current {
|
|
|
|
background: var(--tab-bg-non-selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
li.current {
|
|
|
|
border-bottom: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
li.current:hover {
|
|
|
|
background: var(--tab-bg-hover);
|
|
|
|
}
|
|
|
|
|
|
|
|
li.not-current:hover {
|
|
|
|
background: var(--tab-bg-hover-non-selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
li:active {
|
|
|
|
background: var(--tab-bg-active);
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
2019-05-05 12:30:08 -07:00
|
|
|
padding: 7px 10px;
|
2019-05-04 17:58:44 -07:00
|
|
|
color: var(--body-text-color);
|
|
|
|
font-size: 1.1em;
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
a:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
2020-11-29 14:13:27 -08:00
|
|
|
import { formatIntl } from '../_utils/formatIntl'
|
|
|
|
|
2019-05-04 17:58:44 -07:00
|
|
|
export default {
|
|
|
|
data: () => ({
|
|
|
|
className: ''
|
2020-11-29 14:13:27 -08:00
|
|
|
}),
|
|
|
|
helpers: {
|
|
|
|
createAriaLabel (tabLabel, tabName, currentTabName) {
|
|
|
|
return formatIntl('intl.tabLabel', {
|
|
|
|
label: tabLabel,
|
|
|
|
current: tabName === currentTabName
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2019-05-04 17:58:44 -07:00
|
|
|
}
|
|
|
|
</script>
|