@feelinglovelynow/svelte-loading-anchor
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

🕉 @feelinglovelynow/svelte-loading-anchor

💎 Install

pnpm add @feelinglovelynow/svelte-loading-anchor

🙏 Description

  • SvelteKit component that shows a loading icon when clicked and stops loading after the page navigates
  • Will not show loading icon if href is to the current page
  • Supports <slot /> to add anything in the anchor

💚 Properties

export let href: string = '/'
export let label: string = ''
export let css: string = '' // classes to add to anchor
export let widthRem: number = 1.8 // equivalent to 18px

💛 Prerequisite CSS (available at @feelinglovelynow/global-style)

Requires @feelinglovelynow/global-style or add this css to your site

.fln__circle-load {
  width: 3rem;
  aspect-ratio: 1/1;
  border-width: 0.27rem;
  border-style: solid;
  border-radius: 100%;
  animation: fln__circle-load__spin 0.8s infinite linear;
}

@keyframes fln__circle-load__spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(359deg);
  }
}

html { /* Helps w/ rem, can still look good w/o just set rem/px as desired: https://stackoverflow.com/questions/59920538  */
  font-size: 62.5%;
}

🧡 Prerequisite CSS (NOT available at @feelinglovelynow/global-style)

Define how you would love your loading anchor to look

.fln__circle-load { // gold load with transparent background
  border-color: #eac603 rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
}

.fln__circle-load { // thicker blue load with grey background
  border-width: 0.36rem;
  border-color: #2e96ff #ccc #ccc;
}

❤️ Examples

<script lang="ts">
  import { LoadingAnchor } from '@feelinglovelynow/svelte-loading-anchor'
</script>

<LoadingAnchor href="/test" label="Test" css="example" />

<LoadingAnchor href="/" label="Home" widthRem={ 3 }>
  <div>Slot content</div>
</LoadingAnchor>

💟 Add custom styling

.fln__loading-anchor {

  &--is-loading {

  }

  &__label {

  }

  .fln__circle-load {

  }
}

🎁 All Our Packages

  1. @feelinglovelynow/datetime-local: NPMGithub
  2. @feelinglovelynow/dgraph: NPMGithub
  3. @feelinglovelynow/env-write: NPMGithub
  4. @feelinglovelynow/get-form-entries: NPMGithub
  5. @feelinglovelynow/get-relative-time: NPMGithub
  6. @feelinglovelynow/global-style: NPMGithub
  7. @feelinglovelynow/jwt: NPMGithub
  8. @feelinglovelynow/loop-backwards: NPMGithub
  9. @feelinglovelynow/slug: NPMGithub
  10. @feelinglovelynow/svelte-catch: NPMGithub
  11. @feelinglovelynow/svelte-kv: NPMGithub
  12. @feelinglovelynow/svelte-loading-anchor: NPMGithub
  13. @feelinglovelynow/svelte-modal: NPMGithub
  14. @feelinglovelynow/svelte-turnstile: NPMGithub
  15. @feelinglovelynow/toast: NPMGithub

Package Sidebar

Install

npm i @feelinglovelynow/svelte-loading-anchor

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

10.8 kB

Total Files

16

Last publish

Collaborators

  • feelinglovelynow