2018-01-20 20:35:38 +00:00
|
|
|
<nav class="settings-nav">
|
2018-01-09 01:44:29 +00:00
|
|
|
<ul>
|
2018-05-02 00:05:36 +00:00
|
|
|
{#each navItems as navItem}
|
2018-01-09 01:44:29 +00:00
|
|
|
<li>
|
2018-05-02 00:05:36 +00:00
|
|
|
<SettingsNavItem {page} name={navItem.name} href={navItem.href} label={navItem.label} />
|
2018-01-09 01:44:29 +00:00
|
|
|
</li>
|
2018-05-02 00:05:36 +00:00
|
|
|
{/each}
|
2018-01-13 20:12:17 +00:00
|
|
|
<li>
|
2018-05-02 00:05:36 +00:00
|
|
|
<SettingsNavItem {page} name={page} href="/{page}" {label} />
|
2018-01-13 20:12:17 +00:00
|
|
|
</li>
|
2018-01-09 01:44:29 +00:00
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<style>
|
2018-01-20 20:35:38 +00:00
|
|
|
.settings-nav ul {
|
2018-01-28 02:25:49 +00:00
|
|
|
margin: 20px 20px;
|
2018-01-09 01:44:29 +00:00
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
2018-01-20 20:35:38 +00:00
|
|
|
.settings-nav li {
|
2018-01-14 19:22:57 +00:00
|
|
|
margin: 5px 0;
|
2018-01-13 18:53:25 +00:00
|
|
|
font-size: 1em;
|
2018-01-14 19:22:57 +00:00
|
|
|
display: inline-block;
|
2018-01-09 01:44:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-20 20:35:38 +00:00
|
|
|
.settings-nav li::after {
|
2018-01-13 18:53:25 +00:00
|
|
|
content: '>';
|
|
|
|
margin: 0 15px;
|
|
|
|
color: var(--anchor-text);
|
2018-01-09 01:44:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-20 20:35:38 +00:00
|
|
|
.settings-nav li:last-child::after {
|
2018-01-13 18:53:25 +00:00
|
|
|
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',
|
2018-02-01 02:20:30 +00:00
|
|
|
'settings/general': 'General',
|
2018-01-13 20:12:17 +00:00
|
|
|
'settings/instances': 'Instances',
|
2018-04-04 01:01:22 +00:00
|
|
|
'settings/instances/add': 'Add instance'
|
2018-01-13 18:53:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
SettingsNavItem
|
|
|
|
},
|
|
|
|
computed: {
|
2018-05-02 00:05:36 +00:00
|
|
|
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>
|