Skip to content

Commit

Permalink
docs(guide): loader spinner icon demo added
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Feb 8, 2023
1 parent 4d10b86 commit 0745827
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/components/demos/loader/DemoLoaderSpinnerIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script lang="ts" setup>
import { useDebounceFn, useTimeout } from '@vueuse/core'
import { ref } from 'vue'
const { ready: btnLoaded, start: startBtnLoading } = useTimeout(1500, { controls: true })
const q = ref('')
const { ready: inputLoaded, start: startInputLoading } = useTimeout(1000, { controls: true })
const debouncedStartInputLoading = useDebounceFn(startInputLoading, 500)
</script>

<template>
<div class="grid-row gap-4 grid-flow-row">
<!-- 👉 Button -->
<ABtn @click="startBtnLoading">
<ALoadingIcon
icon="i-bx-cloud-upload"
:loading="!btnLoaded"
/>
<span>Upload</span>
</ABtn>

<!-- 👉 Input -->
<AInput
v-model="q"
@input="debouncedStartInputLoading"
>
<template #prepend-inner>
<ALoadingIcon
icon="i-bx-search"
:loading="!inputLoaded"
/>
</template>
</AInput>
</div>
</template>
11 changes: 11 additions & 0 deletions docs/guide/components/loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ You can customize overlay color and opacity via CSS vars `--a-loader-overlay-bg-
As `ADrawer` & `ADialog` is built on top of `ACard`, you can pass `loading` prop to these components and loader will work without any extra efforts.
:::

<!-- 👉 Spinner Icon -->
::::card Spinner Icon

Anu also provides convenient component `ALoadingIcon` for satisfying your custom needs 😇

:::code DemoLoaderSpinnerIcon
<<< @/components/demos/loader/DemoLoaderSpinnerIcon.vue
:::

::::

<!-- 👉 Slot and Typography -->
::::card Slot and Typography

Expand Down

0 comments on commit 0745827

Please sign in to comment.