Skip to content

Commit 8a4147e

Browse files
authored
Merge pull request #566 from devforth/feature/AdminForth/1404/you've-made-new-loader-for-the
feat: implement new skeleton loader structure and remove unused code
2 parents 0b747a3 + d77238a commit 8a4147e

1 file changed

Lines changed: 12 additions & 52 deletions

File tree

adminforth/spa/src/views/CreateEditSkeleton.vue

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="w-full mt-[36px]">
33
<div class="w-full border dark:border-darkFormBorder border-gray-200 rounded-lg overflow-hidden shadow-resourseFormShadow dark:shadow-darkResourseFormShadow bg-white dark:bg-darkForm">
44

5-
<div class="flex px-6 items-center border-b border-gray-200 dark:border-darkFormBorder bg-lightFormHeading dark:bg-darkFormHeading" style="height: 40px;">
5+
<div class="flex px-6 items-center border-b border-gray-200 dark:border-darkFormBorder bg-lightFormHeading dark:bg-darkFormHeading h-[40px]">
66
<div class="w-[208px] flex-shrink-0 pr-6 text-xs text-lightListTableHeadingText uppercase dark:text-darkListTableHeadingText font-bold">
77
{{ $t('Field') }}
88
</div>
@@ -11,64 +11,24 @@
1111
</div>
1212
</div>
1313

14-
<template v-for="column in visibleColumns" :key="column.name">
15-
<div
16-
class="flex items-center bg-lightForm dark:bg-darkForm border-b border-gray-100 dark:border-darkFormBorder"
17-
:style="{ height: getFieldHeight(column) }"
18-
>
19-
<div class="w-[208px] flex-shrink-0 px-6 flex items-center">
20-
<Skeleton class="w-24 h-[10px]" />
21-
</div>
22-
23-
<div class="flex-1 px-6">
24-
<Skeleton type="input" :class="getSkeletonInputClass(column)" />
14+
<div
15+
v-for="i in 10"
16+
:key="i"
17+
class="flex items-center bg-lightForm dark:bg-darkForm border-b border-gray-100 dark:border-darkFormBorder h-[75px]"
18+
>
19+
<div class="w-[208px] flex-shrink-0 px-6 flex items-center">
20+
<Skeleton class="w-24 h-[10px]" />
21+
</div>
2522

26-
<div v-if="hasEditingNote(column)" class="mt-1">
27-
<Skeleton class="h-[12px] w-20" />
28-
</div>
29-
</div>
23+
<div class="flex-1 px-6">
24+
<Skeleton class="h-[10px] w-full" />
3025
</div>
26+
</div>
3127

32-
</template>
3328
</div>
3429
</div>
3530
</template>
3631

3732
<script setup lang="ts">
38-
import { computed } from 'vue';
3933
import { Skeleton } from '@/afcl';
40-
41-
interface Props {
42-
resource?: any;
43-
page?: string;}
44-
45-
const props = withDefaults(defineProps<Props>(), {
46-
page: 'edit'
47-
});
48-
49-
const visibleColumns = computed(() => {
50-
if (!props.resource?.columns) return [];
51-
52-
return props.resource.columns.filter((col: any) => {
53-
if (col.virtual) return false;
54-
if (col.primaryKey) return false;
55-
if (col.backendOnly) return false;
56-
if (col.showIn?.[props.page] === false) return false;
57-
return true;
58-
});
59-
});
60-
61-
62-
const hasEditingNote = (column: any) => !!column.editingNote;
63-
64-
const getFieldHeight = (column: any) =>
65-
hasEditingNote(column) ? '95px' : '75px';
66-
67-
const getSkeletonInputClass = (column: any) => {
68-
if (['integer', 'decimal', 'float'].includes(column.type)) {
69-
return 'h-[42px] w-[160px]';
70-
}
71-
return 'h-[42px] w-full';
72-
};
73-
7434
</script>

0 commit comments

Comments
 (0)