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