forked from cybrespace/pinafore
42 lines
1018 B
HTML
42 lines
1018 B
HTML
<div class="timeline">
|
|
<VirtualList component="{{StatusListItem}}" items="{{statuses}}" />
|
|
<button type="button" on:click="addMoreItems()">Add more items</button>
|
|
</div>
|
|
<style>
|
|
.timeline {
|
|
padding-right: 10px;
|
|
}
|
|
</style>
|
|
<script>
|
|
import { store } from '../_utils/store'
|
|
import { getHomeTimeline } from '../_utils/mastodon/oauth'
|
|
import fixture from '../_utils/fixture.json'
|
|
import StatusListItem from './StatusListItem.html'
|
|
import VirtualList from './VirtualList.html'
|
|
import { splice } from 'svelte-extras'
|
|
|
|
let i = -1
|
|
|
|
const createData = () => fixture.slice(0, 20).map(_ => ({
|
|
key: `${++i}`,
|
|
props: _
|
|
}))
|
|
|
|
export default {
|
|
data: () => ({
|
|
target: 'home',
|
|
statuses: createData(),
|
|
StatusListItem: StatusListItem
|
|
}),
|
|
store: () => store,
|
|
components: {
|
|
VirtualList
|
|
},
|
|
methods: {
|
|
splice: splice,
|
|
addMoreItems() {
|
|
this.splice('statuses', this.get('statuses').length, 0, ...createData())
|
|
}
|
|
}
|
|
}
|
|
</script> |