forked from jd-solanki/anu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(loader): loader component improvements (jd-solanki#130)
- Loading branch information
1 parent
908f038
commit 4d10b86
Showing
19 changed files
with
173 additions
and
469 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,156 +1,21 @@ | ||
<script lang="ts" setup> | ||
import { onMounted, ref } from 'vue' | ||
import { ref } from 'vue' | ||
const loading = ref(true) | ||
onMounted(() => { | ||
setTimeout(() => { | ||
loading.value = false | ||
}, 5000) | ||
}) | ||
const val = ref('') | ||
const loading = ref(false) | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-wrap gap-6"> | ||
<!-- Alert --> | ||
<AAlert | ||
color="info" | ||
class="relative" | ||
> | ||
Fruitcake I love liquorice apple pie croissant. | ||
<ALoader | ||
:loading="loading" | ||
class="text-2xl" | ||
/> | ||
</AAlert> | ||
<AAlert | ||
color="info" | ||
variant="fill" | ||
class="relative" | ||
> | ||
Fruitcake I love liquorice apple pie croissant. | ||
<ALoader | ||
:loading="loading" | ||
|
||
class="text-2xl" | ||
/> | ||
</AAlert> | ||
<AAlert | ||
color="info" | ||
variant="outline" | ||
class="relative" | ||
> | ||
Fruitcake I love liquorice apple pie croissant. | ||
<ALoader | ||
:loading="loading" | ||
|
||
class="text-2xl bg-white dark:bg-dark" | ||
/> | ||
</AAlert> | ||
<AAlert | ||
color="info" | ||
variant="text" | ||
class="relative" | ||
> | ||
Fruitcake I love liquorice apple pie croissant. | ||
<ALoader | ||
:loading="loading" | ||
|
||
class="text-2xl bg-light dark:bg-dark" | ||
/> | ||
</AAlert> | ||
|
||
<!-- Card --> | ||
<ACard | ||
variant="fill" | ||
color="danger" | ||
title="Card title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
> | ||
<div class="a-card-body a-card-spacer"> | ||
<p class="text-sm"> | ||
<ALoader | ||
:loading="loading" | ||
|
||
class="text-3xl" | ||
title="It's loading..." | ||
subtitle="Click to stop loading." | ||
/> | ||
Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate | ||
bar. | ||
</p> | ||
</div> | ||
</ACard> | ||
|
||
<ACard | ||
variant="light" | ||
color="danger" | ||
> | ||
<ALoader | ||
<AInput | ||
v-model="val" | ||
class="w-300px m-4" | ||
@input="loading = !loading" | ||
> | ||
<template #prepend-inner> | ||
<ALoadingIcon | ||
icon="i-bx-search" | ||
:loading="loading" | ||
|
||
class="text-3xl" | ||
title="It's loading..." | ||
subtitle="Click to stop loading." | ||
/> | ||
<div class="a-card-body a-card-spacer"> | ||
<ATypography | ||
title="Card title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
/> | ||
<p class="text-sm"> | ||
Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate | ||
bar. | ||
</p> | ||
</div> | ||
</ACard> | ||
|
||
<div class="flex gap-x-2"> | ||
<AChip | ||
variant="fill" | ||
class="relative" | ||
> | ||
Primary | ||
<ALoader | ||
:loading="loading" | ||
/> | ||
</AChip> | ||
<AChip class="relative"> | ||
Primary | ||
<ALoader | ||
:loading="loading" | ||
/> | ||
</AChip> | ||
<AChip | ||
variant="outline" | ||
class="relative" | ||
> | ||
Primary | ||
<ALoader | ||
:loading="loading" | ||
|
||
class="bg-white dark:bg-dark" | ||
/> | ||
</AChip> | ||
<AChip | ||
variant="text" | ||
class="relative" | ||
> | ||
Primary | ||
<ALoader | ||
:loading="loading" | ||
class="bg-light dark:bg-dark" | ||
/> | ||
</AChip> | ||
</div> | ||
|
||
<div class="w-full flex gap-6"> | ||
<ABtn | ||
:loading="loading" | ||
variant="fill" | ||
> | ||
Button | ||
</ABtn> | ||
</div> | ||
</div> | ||
</template> | ||
</AInput> | ||
</template> |
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 |
---|---|---|
@@ -1,85 +1,36 @@ | ||
<script lang="ts" setup> | ||
import { useTimeout } from '@vueuse/core' | ||
import { ref } from 'vue' | ||
const { ready, start, stop } = useTimeout(1000, { controls: true }) | ||
const isDialogShown = ref(false) | ||
const isDrawerShown = ref(false) | ||
const btnLoading = ref(false) | ||
const iconBtnLoading = ref(false) | ||
const cardLoading = ref(false) | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-wrap gap-6"> | ||
<ABtn | ||
:loading="!ready" | ||
@click="ready && start()" | ||
:loading="btnLoading" | ||
@click="btnLoading = !btnLoading" | ||
> | ||
Button | ||
</ABtn> | ||
|
||
<ABtn | ||
:loading="!ready" | ||
:loading="iconBtnLoading" | ||
icon-only | ||
icon="i-bx-cloud-upload" | ||
@click="ready && start()" | ||
@click="iconBtnLoading = !iconBtnLoading" | ||
/> | ||
|
||
<!-- Alert --> | ||
<AAlert | ||
variant="fill" | ||
class="relative" | ||
@click="ready && start()" | ||
> | ||
Fruitcake I love liquorice apple pie croissant. | ||
<ALoader | ||
:loading="!ready" | ||
/> | ||
</AAlert> | ||
|
||
<!-- Card --> | ||
<div class="cards-demo-container"> | ||
<ACard | ||
title="Card title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
text="Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar." | ||
:loading="!ready" | ||
@click="ready && start()" | ||
:loading="cardLoading" | ||
@click="cardLoading = !cardLoading" | ||
/> | ||
</div> | ||
|
||
<!-- Dialog --> | ||
<ADialog | ||
v-model="isDialogShown" | ||
title="Dialog title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
text="Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar." | ||
> | ||
<ALoader | ||
:loading="!ready" | ||
overlay | ||
class="text-6xl bg-white" | ||
/> | ||
</ADialog> | ||
|
||
<ABtn @click="isDialogShown = true; start()"> | ||
Show dialog | ||
</ABtn> | ||
|
||
<!-- Drawer --> | ||
<ADrawer | ||
v-model="isDrawerShown" | ||
title="Drawer title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
> | ||
<ALoader | ||
:loading="!ready" | ||
overlay | ||
class="text-6xl bg-white" | ||
/> | ||
</ADrawer> | ||
|
||
<ABtn @click="isDrawerShown = true; start()"> | ||
Show drawer | ||
</ABtn> | ||
</div> | ||
</template> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script lang="ts" setup> | ||
import { useTimeout } from '@vueuse/core' | ||
import { ref } from 'vue' | ||
const { ready, start } = useTimeout(1000, { controls: true }) | ||
const alertLoading = ref(false) | ||
const isDialogShown = ref(false) | ||
const isDrawerShown = ref(false) | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-wrap gap-6"> | ||
<!-- Alert --> | ||
<AAlert | ||
variant="fill" | ||
class="relative" | ||
icon="i-bx-info-circle" | ||
@click="alertLoading = !alertLoading" | ||
> | ||
Click me to toggle loading | ||
<ALoader :loading="alertLoading" /> | ||
</AAlert> | ||
<!-- Dialog --> | ||
<ADialog | ||
v-model="isDialogShown" | ||
title="Dialog title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
text="Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar." | ||
:loading="!ready" | ||
class="[--a-loader-overlay-bg-opacity:1]" | ||
/> | ||
<ABtn @click="isDialogShown = true; start()"> | ||
Show dialog | ||
</ABtn> | ||
<!-- Drawer --> | ||
<ADrawer | ||
v-model="isDrawerShown" | ||
title="Drawer title" | ||
subtitle="Chocolate cake tiramisu donut" | ||
:loading="!ready" | ||
class="[--a-loader-overlay-bg-opacity:1]" | ||
/> | ||
<ABtn @click="isDrawerShown = true; start()"> | ||
Show drawer | ||
</ABtn> | ||
</div> | ||
</template> |
Oops, something went wrong.