-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): add loading state (#259)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
- Loading branch information
1 parent
d20983d
commit 4741532
Showing
5 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
docs/components/content/examples/TableExampleLoadingSlot.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<script setup> | ||
const columns = [{ | ||
key: 'name', | ||
label: 'Name' | ||
}, { | ||
key: 'title', | ||
label: 'Title' | ||
}, { | ||
key: 'email', | ||
label: 'Email' | ||
}, { | ||
key: 'role', | ||
label: 'Role' | ||
}, { | ||
key: 'actions' | ||
}] | ||
const people = [] | ||
const pending = ref(true) | ||
</script> | ||
|
||
<template> | ||
<UTable :rows="people" :columns="columns" :loading="pending"> | ||
<template #loading-state> | ||
<div class="flex items-center justify-center h-32"> | ||
<i class="loader --6" /> | ||
</div> | ||
</template> | ||
</UTable> | ||
</template> | ||
|
||
<style scoped> | ||
/* https://codepen.io/jenning/pen/YzNmzaV */ | ||
.loader { | ||
--color: rgb(var(--color-primary-400)); | ||
--size-mid: 6vmin; | ||
--size-dot: 1.5vmin; | ||
--size-bar: 0.4vmin; | ||
--size-square: 3vmin; | ||
display: block; | ||
position: relative; | ||
width: 50%; | ||
display: grid; | ||
place-items: center; | ||
} | ||
.loader::before, | ||
.loader::after { | ||
content: ''; | ||
box-sizing: border-box; | ||
position: absolute; | ||
} | ||
/** | ||
loader --6 | ||
**/ | ||
.loader.--6::before { | ||
width: var(--size-square); | ||
height: var(--size-square); | ||
background-color: var(--color); | ||
top: calc(50% - var(--size-square)); | ||
left: calc(50% - var(--size-square)); | ||
animation: loader-6 2.4s cubic-bezier(0, 0, 0.24, 1.21) infinite; | ||
} | ||
@keyframes loader-6 { | ||
0%, 100% { | ||
transform: none; | ||
} | ||
25% { | ||
transform: translateX(100%); | ||
} | ||
50% { | ||
transform: translateX(100%) translateY(100%); | ||
} | ||
75% { | ||
transform: translateY(100%); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4741532
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ui – ./
ui-nuxtlabs.vercel.app
ui-git-dev-nuxtlabs.vercel.app
ui.nuxtlabs.com