All files / repo/src/shared/components/Spinner Spinner.vue

100% Statements 20/20
100% Branches 1/1
100% Functions 0/0
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41  1x 1x 1x 1x 1x 1x       1x               1x           1x 1x 1x 1x 1x   1x 6x 6x 6x 6x 6x 1x        
<template>
  <div role="status" :aria-label="ariaLabel" aria-busy="true" class="spinner">
    <div class="spinner-inner">
      <div class="spinner-loader" :style="loaderStyle" />
      <p class="spinner-text">{{ ariaLabel }}</p>
    </div>
  </div>
</template>
 
<script setup lang="ts">
import { computed } from 'vue';
 
interface SpinnerProps {
  size?: 'small' | 'medium' | 'large';
  color?: string;
  ariaLabel?: string;
}
 
const props = withDefaults(defineProps<SpinnerProps>(), {
  size: 'medium',
  color: '#007bff',
  ariaLabel: 'Loading...',
});
 
const sizes = {
  small: '20px',
  medium: '40px',
  large: '60px',
};
 
const loaderStyle = computed(() => ({
  width: sizes[props.size],
  height: sizes[props.size],
  border: `4px solid ${props.color}`,
  borderTopColor: 'transparent',
  borderRadius: '50%',
}));
</script>
 
<style scoped src="././Spinner.scss" />