2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div
|
|
|
|
:class="[
|
|
|
|
$style.root,
|
|
|
|
{
|
|
|
|
[$style.inline]: inline,
|
|
|
|
[$style.colored]: colored,
|
|
|
|
[$style.mini]: mini,
|
|
|
|
},
|
|
|
|
]"
|
|
|
|
>
|
|
|
|
<div :class="$style.container" aria-hidden="true">
|
|
|
|
<svg
|
|
|
|
:class="[$style.spinner]"
|
|
|
|
viewBox="0 0 50 50"
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
>
|
|
|
|
<circle
|
|
|
|
:class="[$style.path]"
|
|
|
|
cx="25"
|
|
|
|
cy="25"
|
|
|
|
r="20"
|
|
|
|
fill="none"
|
|
|
|
stroke-width="6px"
|
|
|
|
style="fill: none; stroke: currentColor; stroke-width: 6px"
|
|
|
|
></circle>
|
|
|
|
</svg>
|
|
|
|
</div>
|
2022-05-19 08:24:35 +02:00
|
|
|
</div>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-15 23:47:28 +01:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
inline?: boolean;
|
|
|
|
colored?: boolean;
|
|
|
|
mini?: boolean;
|
|
|
|
em?: boolean;
|
|
|
|
}>(),
|
|
|
|
{
|
|
|
|
inline: false,
|
|
|
|
colored: true,
|
|
|
|
mini: false,
|
|
|
|
em: false,
|
2023-07-06 03:28:27 +02:00
|
|
|
},
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
2022-05-28 17:15:32 +02:00
|
|
|
<style lang="scss" module>
|
2022-07-27 20:19:57 +02:00
|
|
|
/* Credit to https://codepen.io/supah/pen/BjYLdW */
|
2020-02-10 12:44:59 +01:00
|
|
|
|
2022-07-27 21:27:09 +02:00
|
|
|
@keyframes spin {
|
|
|
|
0% {
|
|
|
|
transform: rotate(0deg);
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
transform: rotate(360deg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes dash {
|
|
|
|
0% {
|
|
|
|
stroke-dasharray: 1, 150;
|
|
|
|
stroke-dashoffset: 0;
|
|
|
|
}
|
|
|
|
50% {
|
|
|
|
stroke-dasharray: 90, 150;
|
|
|
|
stroke-dashoffset: -35;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
stroke-dasharray: 90, 150;
|
|
|
|
stroke-dashoffset: -124;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-28 17:15:32 +02:00
|
|
|
.root {
|
2020-01-29 20:37:25 +01:00
|
|
|
padding: 32px;
|
|
|
|
text-align: center;
|
2021-04-16 16:04:25 +02:00
|
|
|
cursor: wait;
|
|
|
|
|
2022-07-27 21:28:36 +02:00
|
|
|
--size: 40px;
|
2021-08-15 13:26:44 +02:00
|
|
|
|
2021-04-16 16:04:25 +02:00
|
|
|
&.colored {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2020-02-11 18:52:37 +01:00
|
|
|
&.inline {
|
|
|
|
display: inline;
|
|
|
|
padding: 0;
|
2021-08-15 13:26:44 +02:00
|
|
|
--size: 32px;
|
|
|
|
}
|
2020-02-11 18:52:37 +01:00
|
|
|
|
2021-08-15 13:26:44 +02:00
|
|
|
&.mini {
|
|
|
|
padding: 16px;
|
|
|
|
--size: 32px;
|
2020-02-11 18:52:37 +01:00
|
|
|
}
|
2023-02-19 04:48:25 +01:00
|
|
|
&.em {
|
|
|
|
display: inline-block;
|
|
|
|
vertical-align: middle;
|
|
|
|
padding: 0;
|
|
|
|
--size: 1em;
|
|
|
|
}
|
2022-05-28 17:15:32 +02:00
|
|
|
}
|
2020-02-11 18:52:37 +01:00
|
|
|
|
2022-05-28 17:15:32 +02:00
|
|
|
.container {
|
|
|
|
position: relative;
|
|
|
|
width: var(--size);
|
|
|
|
height: var(--size);
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
2020-02-10 12:44:59 +01:00
|
|
|
|
2022-05-28 17:15:32 +02:00
|
|
|
.spinner {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2022-07-27 20:46:52 +02:00
|
|
|
z-index: 999;
|
2022-05-28 17:15:32 +02:00
|
|
|
width: var(--size);
|
|
|
|
height: var(--size);
|
2022-07-27 21:27:09 +02:00
|
|
|
animation: spin 2s linear infinite;
|
2022-07-27 21:32:14 +02:00
|
|
|
}
|
2022-07-27 20:52:10 +02:00
|
|
|
|
2022-07-27 21:32:14 +02:00
|
|
|
.path {
|
|
|
|
stroke: var(--accent);
|
|
|
|
stroke-linecap: round;
|
2022-07-27 21:34:23 +02:00
|
|
|
animation: dash 1.2s ease-in-out infinite;
|
2022-05-28 17:15:32 +02:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
</style>
|