rework spinners
This commit is contained in:
parent
93503de065
commit
6c290689c4
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-if="!loading">
|
||||||
<Spinner v-if="loading" />
|
|
||||||
<template v-else>
|
|
||||||
<div v-for="section in sections" :key="section.key" class="mb-4">
|
<div v-for="section in sections" :key="section.key" class="mb-4">
|
||||||
<template v-if="result[section.key].length > 0">
|
<template v-if="result[section.key].length > 0">
|
||||||
<h1>
|
<h1>
|
||||||
@ -16,7 +14,6 @@
|
|||||||
<AlbumList :items="result[section.key]" />
|
<AlbumList :items="result[section.key]" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<Spinner v-slot="{ data }" :data="albums">
|
<ContentLoader #default :loading="albums == null">
|
||||||
<AlbumList v-if="albums" :items="data" />
|
<AlbumList :items="albums" />
|
||||||
</Spinner>
|
</ContentLoader>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="item">
|
<ContentLoader #default :loading="item == null">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-xl-8">
|
<div class="col col-xl-8">
|
||||||
<h1>{{ item.name }}</h1>
|
<h1>{{ item.name }}</h1>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<ArtistList :items="item.similarArtist" />
|
<ArtistList :items="item.similarArtist" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</ContentLoader>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<template v-if="section === 'tracks'">
|
<template v-if="section === 'tracks'">
|
||||||
<Spinner v-slot="{ data }" :data="tracks">
|
<ContentLoader #default :loading="tracks == null">
|
||||||
<TrackList :tracks="data" />
|
<TrackList :tracks="tracks" />
|
||||||
</Spinner>
|
</ContentLoader>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<Spinner v-slot="{ data }" :data="albums">
|
<ContentLoader #default :loading="albums == null">
|
||||||
<AlbumList :items="data" />
|
<AlbumList :items="albums" />
|
||||||
</Spinner>
|
</ContentLoader>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<Spinner v-slot="{ data }" :data="playlist">
|
<ContentLoader #default :loading="playlist == null">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<h1>{{ data.name }}</h1>
|
<h1>{{ playlist.name }}</h1>
|
||||||
<OverflowMenu>
|
<OverflowMenu>
|
||||||
<b-dropdown-item-btn variant="danger" @click="deletePlaylist()">
|
<b-dropdown-item-btn variant="danger" @click="deletePlaylist()">
|
||||||
Delete playlist
|
Delete playlist
|
||||||
</b-dropdown-item-btn>
|
</b-dropdown-item-btn>
|
||||||
</OverflowMenu>
|
</OverflowMenu>
|
||||||
</div>
|
</div>
|
||||||
<TrackList :tracks="data.tracks" @remove="remove(index)">
|
<TrackList :tracks="playlist.tracks" @remove="remove(index)">
|
||||||
<template v-slot:context-menu="{index}">
|
<template v-slot:context-menu="{index}">
|
||||||
<b-dropdown-item-button @click="remove(index)">
|
<b-dropdown-item-button @click="remove(index)">
|
||||||
Remove
|
Remove
|
||||||
</b-dropdown-item-button>
|
</b-dropdown-item-button>
|
||||||
</template>
|
</template>
|
||||||
</TrackList>
|
</TrackList>
|
||||||
</Spinner>
|
</ContentLoader>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="result">
|
<ContentLoader #default :loading="result == null">
|
||||||
<div v-if="result.artists.length > 0" class="mb-5">
|
<div v-if="result.artists.length > 0" class="mb-5">
|
||||||
<h1>Artists</h1>
|
<h1>Artists</h1>
|
||||||
<ArtistList :items="result.artists" />
|
<ArtistList :items="result.artists" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="result.albums.length > 0" class="mb-5">
|
<div v-if="result.albums.length > 0" class="mb-5">
|
||||||
<h1>Albums</h1>
|
<h1>Albums</h1>
|
||||||
<AlbumList :items="result.albums" />
|
<AlbumList :items="result.albums" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="result.tracks.length > 0">
|
<div v-if="result.tracks.length > 0">
|
||||||
<h1>Tracks</h1>
|
<h1>Tracks</h1>
|
||||||
<TrackList :tracks="result.tracks" />
|
<TrackList :tracks="result.tracks" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</ContentLoader>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
8
src/shared/components/ContentLoader.vue
Normal file
8
src/shared/components/ContentLoader.vue
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<template functional>
|
||||||
|
<div>
|
||||||
|
<div v-if="props.loading" class="d-flex justify-content-center">
|
||||||
|
<span class="spinner-border" />
|
||||||
|
</div>
|
||||||
|
<slot v-else />
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -1,12 +0,0 @@
|
|||||||
<template functional>
|
|
||||||
<div>
|
|
||||||
<slot v-if="props.data" :data="props.data" />
|
|
||||||
<div v-else class="text-center">
|
|
||||||
<span class="spinner-grow" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script lang="ts">
|
|
||||||
import Vue from 'vue'
|
|
||||||
export default Vue.extend({})
|
|
||||||
</script>
|
|
@ -1,16 +1,16 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import ContentLoader from './ContentLoader.vue'
|
||||||
import ExternalLink from './ExternalLink.vue'
|
import ExternalLink from './ExternalLink.vue'
|
||||||
import Icon from './Icon.vue'
|
import Icon from './Icon.vue'
|
||||||
import OverflowMenu from './OverflowMenu.vue'
|
import OverflowMenu from './OverflowMenu.vue'
|
||||||
import Spinner from './Spinner.vue'
|
|
||||||
import Tiles from './Tiles.vue'
|
import Tiles from './Tiles.vue'
|
||||||
import Tile from './Tile.vue'
|
import Tile from './Tile.vue'
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
|
ContentLoader,
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
Icon,
|
Icon,
|
||||||
OverflowMenu,
|
OverflowMenu,
|
||||||
Spinner,
|
|
||||||
Tiles,
|
Tiles,
|
||||||
Tile,
|
Tile,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user