2018-02-08 07:49:50 +01:00
|
|
|
<li class="page-list-item">
|
2018-05-02 02:05:36 +02:00
|
|
|
<a {href}>
|
2018-03-16 16:42:10 +01:00
|
|
|
<svg class="page-list-item-svg">
|
2018-05-02 02:05:36 +02:00
|
|
|
<use xlink:href={icon} />
|
2018-02-08 07:49:50 +01:00
|
|
|
</svg>
|
2018-08-28 15:44:36 +02:00
|
|
|
<span aria-label={ariaLabel}>
|
2018-05-02 02:05:36 +02:00
|
|
|
{label}
|
2018-02-08 07:49:50 +01:00
|
|
|
</span>
|
2018-05-02 02:05:36 +02:00
|
|
|
{#if pinnable}
|
2018-02-11 01:03:28 +01:00
|
|
|
<IconButton pressable="true"
|
2018-05-02 02:05:36 +02:00
|
|
|
pressed={$pinnedPage === href}
|
|
|
|
label={$pinnedPage === href ? 'Unpin timeline' : 'Pin timeline'}
|
2018-02-11 01:03:28 +01:00
|
|
|
href="#fa-thumb-tack"
|
|
|
|
on:click="onPinClick(event)" />
|
2018-05-02 02:05:36 +02:00
|
|
|
{/if}
|
2018-02-08 07:49:50 +01:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<style>
|
|
|
|
.page-list-item {
|
|
|
|
border: 1px solid var(--settings-list-item-border);
|
|
|
|
font-size: 1.3em;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
.page-list-item a {
|
|
|
|
padding: 20px 40px;
|
|
|
|
background: var(--settings-list-item-bg);
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: min-content 1fr min-content;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.page-list-item a, .page-list-item a:visited {
|
|
|
|
color: var(--body-text-color);
|
|
|
|
}
|
|
|
|
.page-list-item a:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
background: var(--settings-list-item-bg-hover);
|
|
|
|
color: var(--body-text-color);
|
|
|
|
}
|
|
|
|
.page-list-item a:active {
|
|
|
|
background: var(--settings-list-item-bg-active);
|
|
|
|
}
|
2018-03-16 16:42:10 +01:00
|
|
|
.page-list-item-svg {
|
2018-02-08 07:49:50 +01:00
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
display: inline-block;
|
|
|
|
margin-right: 20px;
|
|
|
|
fill: var(--body-text-color);
|
|
|
|
}
|
|
|
|
.page-list-item span {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
.page-list-item a {
|
|
|
|
padding: 20px 10px;
|
|
|
|
}
|
2018-03-16 16:42:10 +01:00
|
|
|
.page-list-item-svg {
|
2018-02-08 07:49:50 +01:00
|
|
|
margin-right: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import { store } from '../../_store/store'
|
|
|
|
import IconButton from '../../_components/IconButton'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
store: () => store,
|
2018-04-30 18:57:49 +02:00
|
|
|
data: () => ({
|
|
|
|
pinnable: false
|
|
|
|
}),
|
2018-08-28 15:44:36 +02:00
|
|
|
computed: {
|
|
|
|
ariaLabel: ({label, pinnable, $pinnedPage, href}) => {
|
|
|
|
let res = label
|
|
|
|
if (pinnable) {
|
|
|
|
res += ' (' + ($pinnedPage === href ? 'Pinned page' : 'Unpinned page') + ')'
|
|
|
|
}
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
},
|
2018-02-08 07:49:50 +01:00
|
|
|
components: {
|
|
|
|
IconButton
|
|
|
|
},
|
|
|
|
methods: {
|
2018-04-20 06:38:01 +02:00
|
|
|
onPinClick (e) {
|
2018-02-08 07:49:50 +01:00
|
|
|
e.preventDefault()
|
2018-04-19 18:37:05 +02:00
|
|
|
let { currentInstance, pinnedPages } = this.store.get()
|
|
|
|
let { href } = this.get()
|
2018-02-08 07:49:50 +01:00
|
|
|
pinnedPages[currentInstance] = href
|
|
|
|
this.store.set({pinnedPages: pinnedPages})
|
2018-02-08 18:15:25 +01:00
|
|
|
this.store.save()
|
2018-02-08 07:49:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|