mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe.git
synced 2024-11-15 13:04:43 +00:00
Add note for empty state to the lists using slot
This commit is contained in:
parent
b4a5b5203f
commit
a5162bd636
3 changed files with 21 additions and 4 deletions
|
@ -164,11 +164,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :label="$t('settings.blocks_tab')">
|
<div :label="$t('settings.blocks_tab')">
|
||||||
<block-list :refresh="true" />
|
<block-list :refresh="true">
|
||||||
|
<template slot="empty">No blocks</template>
|
||||||
|
</block-list>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :label="$t('settings.mutes_tab')">
|
<div :label="$t('settings.mutes_tab')">
|
||||||
<mute-list :refresh="true" />
|
<mute-list :refresh="true">
|
||||||
|
<template slot="empty">No mutes</template>
|
||||||
|
</mute-list>
|
||||||
</div>
|
</div>
|
||||||
</tab-switcher>
|
</tab-switcher>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import map from 'lodash/map'
|
import map from 'lodash/map'
|
||||||
|
import isEmpty from 'lodash/isEmpty'
|
||||||
|
import './with_list.scss'
|
||||||
|
|
||||||
const defaultEntryPropsGetter = entry => ({ entry })
|
const defaultEntryPropsGetter = entry => ({ entry })
|
||||||
const defaultKeyGetter = entry => entry.id
|
const defaultKeyGetter = entry => entry.id
|
||||||
|
@ -9,6 +11,11 @@ const withList = ({
|
||||||
getKey = defaultKeyGetter // funciton to accept entry and index values and return key prop value
|
getKey = defaultKeyGetter // funciton to accept entry and index values and return key prop value
|
||||||
}) => (ItemComponent) => (
|
}) => (ItemComponent) => (
|
||||||
Vue.component('withList', {
|
Vue.component('withList', {
|
||||||
|
props: [
|
||||||
|
'entries', // array of entry
|
||||||
|
'entryProps', // additional props to be passed into each entry
|
||||||
|
'entryListeners' // additional event listeners to be passed into each entry
|
||||||
|
],
|
||||||
render (createElement) {
|
render (createElement) {
|
||||||
return (
|
return (
|
||||||
<div class="with-list">
|
<div class="with-list">
|
||||||
|
@ -23,10 +30,10 @@ const withList = ({
|
||||||
}
|
}
|
||||||
return <ItemComponent {...props} />
|
return <ItemComponent {...props} />
|
||||||
})}
|
})}
|
||||||
|
{isEmpty(this.entries) && this.$slots.empty && <div class="with-list-empty-content faint">{this.$slots.empty}</div>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
props: ['entries', 'entryProps', 'entryListeners']
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
6
src/hocs/with_list/with_list.scss
Normal file
6
src/hocs/with_list/with_list.scss
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.with-list {
|
||||||
|
&-empty-content {
|
||||||
|
text-align: center;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue