mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
fix: improve skeletons
This commit is contained in:
parent
fcfcd767f0
commit
42e97c749a
9 changed files with 215 additions and 129 deletions
|
@ -3,6 +3,7 @@ import { randint } from '@/helpers/commons'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<BSkeletonWrapper button search>
|
||||||
<BInputGroup class="w-100 mb-4">
|
<BInputGroup class="w-100 mb-4">
|
||||||
<BInputGroupText>
|
<BInputGroupText>
|
||||||
<YIcon iname="search" />
|
<YIcon iname="search" />
|
||||||
|
@ -34,6 +35,7 @@ import { randint } from '@/helpers/commons'
|
||||||
/>
|
/>
|
||||||
</BCard>
|
</BCard>
|
||||||
</BCardGroup>
|
</BCardGroup>
|
||||||
|
</BSkeletonWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
withDefaults(defineProps<{ height?: string; width?: string }>(), {
|
||||||
height: string
|
height: '26px',
|
||||||
width: string
|
width: '100%',
|
||||||
}>()
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -13,7 +13,7 @@ defineProps<{
|
||||||
.b-skeleton {
|
.b-skeleton {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: $gray-200;
|
background-color: var(--bs-secondary-bg);
|
||||||
cursor: wait;
|
cursor: wait;
|
||||||
|
|
||||||
height: $font-size-base;
|
height: $font-size-base;
|
||||||
|
@ -22,9 +22,5 @@ defineProps<{
|
||||||
@if $enable-rounded {
|
@if $enable-rounded {
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-bs-theme='dark'] & {
|
|
||||||
background-color: $gray-800;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,16 +1,96 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
withDefaults(defineProps<{ loading?: boolean }>(), { loading: false })
|
withDefaults(defineProps<{ button: boolean; search: boolean }>(), {
|
||||||
|
button: false,
|
||||||
|
search: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const slots = defineSlots<{
|
||||||
|
default: any
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="loading" class="b-skeleton-wrapper">
|
<div class="y-skeleton-wrapper">
|
||||||
<slot name="loading" />
|
<div class="visually-hidden">
|
||||||
|
<!-- FIXME add `loading` translation -->
|
||||||
|
{{ $t('loading') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="search || button" id="top-bar-skeleton" class="d-flex mb-3">
|
||||||
|
<div id="search-skeleton" class="top-bar-group-skeleton">
|
||||||
|
<BInputGroup v-if="search" class="pe-none" aria-hidden="true">
|
||||||
|
<BInputGroupText>
|
||||||
|
<YIcon iname="search" />
|
||||||
|
</BInputGroupText>
|
||||||
|
|
||||||
|
<BFormInput :disabled="true" tabindex="-1" />
|
||||||
|
</BInputGroup>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="button" id="button-skeleton" class="top-bar-group-skeleton">
|
||||||
|
<BSkeleton height="36px" class="ms-3-md" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<slot name="default" />
|
||||||
</div>
|
</div>
|
||||||
<slot v-else name="default" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.b-skeleton-wrapper {
|
.y-skeleton-wrapper {
|
||||||
cursor: wait;
|
cursor: wait;
|
||||||
|
|
||||||
|
#top-bar-skeleton {
|
||||||
|
flex-wrap: wrap-reverse;
|
||||||
|
|
||||||
|
.top-bar-group-skeleton {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#button-skeleton {
|
||||||
|
width: 170px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-breakpoint-down(sm) {
|
||||||
|
.top-bar-group-skeleton {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
#button-skeleton {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-breakpoint-down(md) {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
|
||||||
|
#button-skeleton {
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
|
||||||
|
:deep(> *) {
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-bar-group-skeleton {
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
#search-skeleton {
|
||||||
|
flex-grow: 2;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#button-skeleton {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.btn) {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,22 +2,17 @@
|
||||||
import { randint } from '@/helpers/commons'
|
import { randint } from '@/helpers/commons'
|
||||||
import type { Cols } from '@/types/commons'
|
import type { Cols } from '@/types/commons'
|
||||||
|
|
||||||
withDefaults(
|
withDefaults(defineProps<{ itemCount?: number; cols: Cols }>(), {
|
||||||
defineProps<{
|
|
||||||
itemCount?: number
|
|
||||||
cols: Cols
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
itemCount: 5,
|
itemCount: 5,
|
||||||
cols: () => ({ md: 4, lg: 2 }),
|
cols: () => ({ md: 4, lg: 2 }),
|
||||||
},
|
})
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<BSkeletonWrapper>
|
||||||
<BCard>
|
<BCard>
|
||||||
<template #header>
|
<template #header>
|
||||||
<BSkeleton width="30%" height="36px" class="m-0" />
|
<BSkeleton width="30%" height="26px" class="m-0" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-for="count in itemCount" :key="count">
|
<template v-for="count in itemCount" :key="count">
|
||||||
|
@ -53,8 +48,9 @@ withDefaults(
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="d-flex justify-content-end w-100">
|
<div class="d-flex justify-content-end w-100">
|
||||||
<BSkeleton width="100px" height="38px" />
|
<BSkeleton width="100px" height="36px" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</BCard>
|
</BCard>
|
||||||
|
</BSkeletonWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -5,6 +5,7 @@ withDefaults(defineProps<{ itemCount: number }>(), { itemCount: 5 })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<BSkeletonWrapper>
|
||||||
<BCard>
|
<BCard>
|
||||||
<template #header>
|
<template #header>
|
||||||
<BSkeleton width="30%" height="36px" class="m-0" />
|
<BSkeleton width="30%" height="36px" class="m-0" />
|
||||||
|
@ -19,4 +20,5 @@ withDefaults(defineProps<{ itemCount: number }>(), { itemCount: 5 })
|
||||||
</BCol>
|
</BCol>
|
||||||
</BRow>
|
</BRow>
|
||||||
</BCard>
|
</BCard>
|
||||||
|
</BSkeletonWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { randint } from '@/helpers/commons'
|
import { randint } from '@/helpers/commons'
|
||||||
|
|
||||||
withDefaults(defineProps<{ itemCount: number }>(), { itemCount: 5 })
|
withDefaults(defineProps<{ itemCount: number; search: boolean }>(), {
|
||||||
|
itemCount: 5,
|
||||||
|
search: false,
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<BSkeletonWrapper :search="search">
|
||||||
<BCard no-body>
|
<BCard no-body>
|
||||||
<template #header>
|
<template #header>
|
||||||
<BSkeleton width="30%" height="36px" class="m-0" />
|
<BSkeleton width="30%" height="36px" class="m-0" />
|
||||||
|
@ -23,4 +27,5 @@ withDefaults(defineProps<{ itemCount: number }>(), { itemCount: 5 })
|
||||||
</BListGroupItem>
|
</BListGroupItem>
|
||||||
</BListGroup>
|
</BListGroup>
|
||||||
</BCard>
|
</BCard>
|
||||||
|
</BSkeletonWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { randint } from '@/helpers/commons'
|
import { randint } from '@/helpers/commons'
|
||||||
|
|
||||||
withDefaults(defineProps<{ itemCount: number }>(), { itemCount: 5 })
|
withDefaults(
|
||||||
|
defineProps<{ itemCount: number; button: boolean; search: boolean }>(),
|
||||||
|
{ itemCount: 5, button: true, search: true },
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<BSkeletonWrapper :button="button" :search="search">
|
||||||
<BListGroup>
|
<BListGroup>
|
||||||
<BListGroupItem v-for="count in itemCount" :key="count">
|
<BListGroupItem v-for="count in itemCount" :key="count">
|
||||||
<BSkeleton :width="randint(15, 25) + '%'" height="24px" class="mb-2" />
|
<BSkeleton :width="randint(15, 25) + '%'" height="24px" class="mb-2" />
|
||||||
<BSkeleton :width="randint(25, 50) + '%'" height="24px" class="m-0" />
|
<BSkeleton :width="randint(25, 50) + '%'" height="24px" class="m-0" />
|
||||||
</BListGroupItem>
|
</BListGroupItem>
|
||||||
</BListGroup>
|
</BListGroup>
|
||||||
|
</BSkeletonWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -77,7 +77,7 @@ const modalComponent = computed(() => {
|
||||||
<Component :is="Component" :class="classes" />
|
<Component :is="Component" :class="classes" />
|
||||||
<template #fallback>
|
<template #fallback>
|
||||||
<template v-for="({ is, ...props }, i) in skeletons" :key="i">
|
<template v-for="({ is, ...props }, i) in skeletons" :key="i">
|
||||||
<Component :is="is" v-bind="props" />
|
<Component :is="is" v-bind="props" :class="{ 'mt-3': i !== 0 }" />
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
|
@ -239,7 +239,7 @@ const routes: RouteRecordRaw[] = [
|
||||||
meta: {
|
meta: {
|
||||||
args: { trad: 'services' },
|
args: { trad: 'services' },
|
||||||
breadcrumb: ['tool-list', 'service-list'],
|
breadcrumb: ['tool-list', 'service-list'],
|
||||||
skeleton: 'ListGroupSkeleton',
|
skeleton: { is: 'ListGroupSkeleton', button: false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ const routes: RouteRecordRaw[] = [
|
||||||
meta: {
|
meta: {
|
||||||
args: { param: 'name' },
|
args: { param: 'name' },
|
||||||
breadcrumb: ['tool-list', 'service-list', 'service-info'],
|
breadcrumb: ['tool-list', 'service-list', 'service-info'],
|
||||||
skeleton: 'CardInfoSkeleton',
|
skeleton: ['CardInfoSkeleton', 'CardInfoSkeleton'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ const routes: RouteRecordRaw[] = [
|
||||||
meta: {
|
meta: {
|
||||||
args: { trad: 'logs' },
|
args: { trad: 'logs' },
|
||||||
breadcrumb: ['tool-list', 'tool-logs'],
|
breadcrumb: ['tool-list', 'tool-logs'],
|
||||||
skeleton: 'CardListSkeleton',
|
skeleton: { is: 'CardListSkeleton', search: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ const routes: RouteRecordRaw[] = [
|
||||||
meta: {
|
meta: {
|
||||||
args: { param: 'name' },
|
args: { param: 'name' },
|
||||||
breadcrumb: ['tool-list', 'tool-logs', 'tool-log'],
|
breadcrumb: ['tool-list', 'tool-logs', 'tool-log'],
|
||||||
skeleton: 'CardInfoSkeleton',
|
skeleton: ['CardInfoSkeleton', 'CardInfoSkeleton'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue