Skip to content

Commit 6b49670

Browse files
committed
feat: implement new skeleton loader structure and remove unused code
1 parent 67d4e3b commit 6b49670

1 file changed

Lines changed: 12 additions & 71 deletions

File tree

adminforth/spa/src/views/CreateEditSkeleton.vue

Lines changed: 12 additions & 71 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,83 +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, markRaw } from 'vue';
39-
import {
40-
IconLinkOutline, IconCodeOutline, IconRectangleListOutline,
41-
IconOrderedListOutline, IconLetterBoldOutline, IconLetterUnderlineOutline,
42-
IconLetterItalicOutline, IconTextSlashOutline
43-
} from '@iconify-prerendered/vue-flowbite';
44-
import { IconH116Solid, IconH216Solid, IconH316Solid } from '@iconify-prerendered/vue-heroicons';
4533
import { Skeleton } from '@/afcl';
46-
47-
interface Props {
48-
resource?: any;
49-
page?: string;}
50-
51-
const props = withDefaults(defineProps<Props>(), {
52-
page: 'edit'
53-
});
54-
55-
const visibleColumns = computed(() => {
56-
if (!props.resource?.columns) return [];
57-
58-
return props.resource.columns.filter((col: any) => {
59-
if (col.virtual) return false;
60-
if (col.primaryKey) return false;
61-
if (col.backendOnly) return false;
62-
if (col.showIn?.[props.page] === false) return false;
63-
return true;
64-
});
65-
});
66-
67-
68-
const hasEditingNote = (column: any) => !!column.editingNote;
69-
70-
const getFieldHeight = (column: any) =>
71-
hasEditingNote(column) ? '95px' : '75px';
72-
73-
const getSkeletonInputClass = (column: any) => {
74-
if (['integer', 'decimal', 'float'].includes(column.type)) {
75-
return 'h-[42px] w-[160px]';
76-
}
77-
return 'h-[42px] w-full';
78-
};
79-
80-
const skeletonButtons = [
81-
{ id: 'bold', icon: markRaw(IconLetterBoldOutline), sep: false },
82-
{ id: 'italic', icon: markRaw(IconLetterItalicOutline), sep: false },
83-
{ id: 'underline', icon: markRaw(IconLetterUnderlineOutline), sep: false },
84-
{ id: 'strike', icon: markRaw(IconTextSlashOutline), sep: true },
85-
{ id: 'h1', icon: markRaw(IconH116Solid), sep: false },
86-
{ id: 'h2', icon: markRaw(IconH216Solid), sep: false },
87-
{ id: 'h3', icon: markRaw(IconH316Solid), sep: true },
88-
{ id: 'ul', icon: markRaw(IconRectangleListOutline), sep: false },
89-
{ id: 'ol', icon: markRaw(IconOrderedListOutline), sep: false },
90-
{ id: 'link', icon: markRaw(IconLinkOutline), sep: false },
91-
{ id: 'codeBlock', icon: markRaw(IconCodeOutline), sep: false },
92-
];
9334
</script>

0 commit comments

Comments
 (0)