chore(client): tweak loading spinner design

This commit is contained in:
syuilo 2022-05-19 15:24:35 +09:00
parent 7ed0763ad2
commit 4fc2058745
3 changed files with 60 additions and 44 deletions

View file

@ -39,28 +39,24 @@ html {
width: 28px; width: 28px;
height: 28px; height: 28px;
transform: translateY(70px); transform: translateY(70px);
color: var(--accent);
} }
#splashSpinner > .spinner {
#splashSpinner:before,
#splashSpinner:after {
content: " ";
display: block;
box-sizing: border-box;
width: 28px;
height: 28px;
border-radius: 50%;
border: solid 4px;
}
#splashSpinner:before {
border-color: currentColor;
opacity: 0.3;
}
#splashSpinner:after {
position: absolute; position: absolute;
top: 0; top: 0;
border-color: currentColor transparent transparent transparent; left: 0;
width: 28px;
height: 28px;
fill-rule: evenodd;
clip-rule: evenodd;
stroke-linecap: round;
stroke-linejoin: round;
stroke-miterlimit: 1.5;
}
#splashSpinner > .spinner.bg {
opacity: 0.275;
}
#splashSpinner > .spinner.fg {
animation: splashSpinner 0.5s linear infinite; animation: splashSpinner 0.5s linear infinite;
} }

View file

@ -65,4 +65,14 @@ html
div#splash div#splash
img#splashIcon(src= icon || '/static-assets/splash.png') img#splashIcon(src= icon || '/static-assets/splash.png')
div#splashSpinner div#splashSpinner
<svg class="spinner bg" viewBox="0 0 152 152" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1,0,0,1,12,12)">
<circle cx="64" cy="64" r="64" style="fill:none;stroke:currentColor;stroke-width:24px;"/>
</g>
</svg>
<svg class="spinner fg" viewBox="0 0 152 152" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1,0,0,1,12,12)">
<path d="M128,64C128,28.654 99.346,0 64,0C99.346,0 128,28.654 128,64Z" style="fill:none;stroke:currentColor;stroke-width:24px;"/>
</g>
</svg>
block content block content

View file

@ -1,6 +1,17 @@
<template> <template>
<div class="yxspomdl" :class="{ inline, colored, mini }"> <div class="yxspomdl" :class="{ inline, colored, mini }">
<div class="ring"></div> <div class="container">
<svg class="spinner bg" viewBox="0 0 152 152" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1,0,0,1,12,12)">
<circle cx="64" cy="64" r="64" style="fill:none;stroke:currentColor;stroke-width:24px;"/>
</g>
</svg>
<svg class="spinner fg" viewBox="0 0 152 152" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1,0,0,1,12,12)">
<path d="M128,64C128,28.654 99.346,0 64,0C99.346,0 128,28.654 128,64Z" style="fill:none;stroke:currentColor;stroke-width:24px;"/>
</g>
</svg>
</div>
</div> </div>
</template> </template>
@ -19,7 +30,7 @@ const props = withDefaults(defineProps<{
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@keyframes ring { @keyframes spinner {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
@ -33,7 +44,7 @@ const props = withDefaults(defineProps<{
text-align: center; text-align: center;
cursor: wait; cursor: wait;
--size: 48px; --size: 40px;
&.colored { &.colored {
color: var(--accent); color: var(--accent);
@ -50,32 +61,31 @@ const props = withDefaults(defineProps<{
--size: 32px; --size: 32px;
} }
> .ring { > .container {
position: relative; position: relative;
display: inline-block; width: var(--size);
vertical-align: middle; height: var(--size);
margin: 0 auto;
&:before, > .spinner {
&:after {
content: " ";
display: block;
box-sizing: border-box;
width: var(--size);
height: var(--size);
border-radius: 50%;
border: solid 4px;
}
&:before {
border-color: currentColor;
opacity: 0.3;
}
&:after {
position: absolute; position: absolute;
top: 0; top: 0;
border-color: currentColor transparent transparent transparent; left: 0;
animation: ring 0.5s linear infinite; width: var(--size);
height: var(--size);
fill-rule: evenodd;
clip-rule: evenodd;
stroke-linecap: round;
stroke-linejoin: round;
stroke-miterlimit: 1.5;
}
> .bg {
opacity: 0.275;
}
> .fg {
animation: spinner 0.5s linear infinite;
} }
} }
} }