2018-01-09 01:44:29 +00:00
|
|
|
<nav>
|
|
|
|
<ul>
|
2018-01-13 18:53:25 +00:00
|
|
|
{{#each navItems as navItem}}
|
2018-01-09 01:44:29 +00:00
|
|
|
<li>
|
2018-01-13 20:12:17 +00:00
|
|
|
<SettingsNavItem :page name="{{navItem.name}}" href="{{navItem.href}}" label="{{navItem.label}}" />
|
2018-01-09 01:44:29 +00:00
|
|
|
</li>
|
2018-01-13 18:53:25 +00:00
|
|
|
{{/each}}
|
2018-01-13 20:12:17 +00:00
|
|
|
<li>
|
|
|
|
<SettingsNavItem :page name="{{page}}" href="/{{page}}" :label />
|
|
|
|
</li>
|
2018-01-09 01:44:29 +00:00
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
li {
|
2018-01-13 18:53:25 +00:00
|
|
|
margin: 10px 0;
|
|
|
|
font-size: 1em;
|
2018-01-09 01:44:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-13 18:53:25 +00:00
|
|
|
li::after {
|
|
|
|
content: '>';
|
|
|
|
margin: 0 15px;
|
|
|
|
color: var(--anchor-text);
|
2018-01-09 01:44:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-13 18:53:25 +00:00
|
|
|
li:last-child::after {
|
|
|
|
content: '';
|
|
|
|
margin-left: 0;
|
|
|
|
font-size: 1em;
|
2018-01-09 01:44:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-13 18:53:25 +00:00
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import SettingsNavItem from './SettingsNavItem.html'
|
|
|
|
|
|
|
|
const NAV_ITEMS = {
|
2018-01-13 20:12:17 +00:00
|
|
|
'settings': 'Settings',
|
|
|
|
'settings/about': 'About Pinafore',
|
|
|
|
'settings/instances': 'Instances',
|
|
|
|
'settings/instances/add': 'Add an instance',
|
2018-01-13 18:53:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
SettingsNavItem
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
navItems: page => {
|
2018-01-13 20:12:17 +00:00
|
|
|
let res = []
|
|
|
|
let breadcrumbs = page.split('/')
|
|
|
|
let path = ''
|
|
|
|
for (let i = 0; i < breadcrumbs.length - 1; i++) {
|
|
|
|
let currentPage = breadcrumbs[i]
|
|
|
|
path += currentPage
|
|
|
|
res.push({
|
|
|
|
label: NAV_ITEMS[path],
|
|
|
|
href: `/${path}`,
|
|
|
|
name: path
|
|
|
|
})
|
|
|
|
path += '/'
|
2018-01-13 18:53:25 +00:00
|
|
|
}
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|