You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
57 lines
1.7 KiB
<potato-sorting>
|
|
<div class="filter">
|
|
<button class="button button--icon button--hover-icon-contrast m-bottom-0" if={ state.column === 'name' } onclick={ (event) => { handleToggle(event) }}>
|
|
<svg class="icon icon--big">
|
|
<use xlink:href="symbol-defs.svg#icon-text" />
|
|
</svg>
|
|
</button>
|
|
<button class="button button--icon button--hover-icon-contrast m-bottom-0" if={ state.column === 'date_started' } onclick={ (event) => { handleToggle(event) }}>
|
|
<svg class="icon icon--big">
|
|
<use xlink:href="symbol-defs.svg#icon-clock" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
import appsStore from './../stores/apps.js'
|
|
|
|
/**
|
|
* sorting of apps
|
|
*
|
|
* @author Björn Hase <me@herr-hase.wtf>
|
|
* @license hhttps://www.gnu.org/licenses/gpl-3.0.en.html GPL-3
|
|
* @link https://gitea.node001.net/HerrHase/potato-launcher.git
|
|
*
|
|
*/
|
|
|
|
export default {
|
|
|
|
state: {
|
|
column: 'name'
|
|
},
|
|
|
|
/**
|
|
* toggle sorting
|
|
*
|
|
*
|
|
* @param {[type]} event
|
|
*
|
|
*/
|
|
handleToggle(event) {
|
|
event.preventDefault()
|
|
|
|
if (this.state.column === 'name') {
|
|
this.state.column = 'date_started'
|
|
} else if (this.state.column === 'date_started') {
|
|
this.state.column = 'name'
|
|
}
|
|
|
|
appsStore.sort(this.state.column)
|
|
|
|
this.update()
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</potato-sorting> |