2FAuth/resources/js_vue3/components/Spinner.vue

65 lines
1.7 KiB
Vue
Raw Normal View History

2023-10-05 14:03:00 +02:00
<script setup>
const props = defineProps({
isVisible: Boolean,
type: {
type: String,
default: 'inline'
},
message: {
type: String,
default: 'commons.generating_otp'
}
2023-10-05 14:03:00 +02:00
})
</script>
<template>
<div v-if="isVisible">
<div v-if="type == 'fullscreen'" class="spinner-container">
<div class="spinner-wrapper">
<span id="icnSpinnerFull" class="is-size-1 spinner">
<FontAwesomeIcon :icon="['fas', 'spinner']" spin />
</span>
<span>{{ $t(message) }}</span>
</div>
</div>
<div v-if="type == 'fullscreen-overlay'" class="spinner-overlay-container">
<div class="spinner-wrapper">
<span id="icnSpinnerFull" class="is-size-1 spinner">
<FontAwesomeIcon :icon="['fas', 'spinner']" spin />
</span>
<span>{{ $t(message) }}</span>
</div>
</div>
<FontAwesomeIcon v-else-if="type == 'raw'" :icon="['fas', 'spinner']" spin />
<div v-else class="has-text-centered mt-6">
2023-10-05 14:03:00 +02:00
<span id="icnSpinner" class="is-size-4">
<FontAwesomeIcon :icon="['fas', 'spinner']" spin />
</span>
</div>
</div>
</template>
<style scoped>
.spinner-container,
.spinner-overlay-container {
text-align: center;
z-index: 100000;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
.spinner-container,
.spinner-overlay-container {
top: 25%;
height: 50%;
}
.spinner {
display: block;
}
</style>