-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use satellite icon for spinner
Signed-off-by: David Dal Busco <[email protected]>
- Loading branch information
1 parent
3fedeef
commit d57f999
Showing
4 changed files
with
49 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,65 @@ | ||
<!-- adapted from pen: https://codepen.io/mimoh/pen/VmVqPB --> | ||
<script lang="ts"> | ||
export let inline = false; | ||
import IconSatellite from '$lib/components/icons/IconSatellite.svelte'; | ||
// Source of the animation: https://codepen.io/nelledejones/pen/gOOPWrK | ||
export let animation: 'gelatine' | 'swing' = 'gelatine'; | ||
export let small = false; | ||
</script> | ||
|
||
<div class="spinner" class:inline /> | ||
<div class="spinner" class:swing={animation === 'swing'} class:gelatine={animation === 'gelatine'}> | ||
<IconSatellite size={small ? '16px' : '40px'} /> | ||
</div> | ||
|
||
<style lang="scss"> | ||
@use '../../styles/mixins/media'; | ||
@include media.dark-theme { | ||
.spinner { | ||
border-color: var(--text-color); | ||
/* -global- */ | ||
@keyframes -global-gelatine { | ||
from, | ||
to { | ||
transform: scale(1, 1); | ||
} | ||
} | ||
@include media.light-theme { | ||
.spinner.inline { | ||
border-color: var(--color-primary); | ||
25% { | ||
transform: scale(0.9, 1.1); | ||
} | ||
} | ||
.spinner { | ||
display: block; | ||
background: transparent; | ||
border: var(--spinner-border-size, 2px) solid var(--label-color); | ||
margin: var(--spinner-margin); | ||
width: var(--spinner-size); | ||
height: var(--spinner-size); | ||
border-radius: var(--border-radius); | ||
&:not(.inline) { | ||
position: absolute; | ||
top: calc(50% - (var(--spinner-size) / 2)); | ||
left: calc(50% - (var(--spinner-size) / 2)); | ||
50% { | ||
transform: scale(1.1, 0.9); | ||
} | ||
75% { | ||
transform: scale(0.95, 1.05); | ||
} | ||
animation: spinner-rotate 1.2s infinite linear; | ||
} | ||
/* -global- */ | ||
@keyframes -global-spinner-rotate { | ||
0% { | ||
transform: perspective(120px) rotateX(0deg) rotateY(0deg); | ||
@keyframes -global-swing { | ||
20% { | ||
transform: rotate(15deg); | ||
} | ||
50% { | ||
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg); | ||
40% { | ||
transform: rotate(-10deg); | ||
} | ||
60% { | ||
transform: rotate(5deg); | ||
} | ||
80% { | ||
transform: rotate(-5deg); | ||
} | ||
100% { | ||
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); | ||
transform: rotate(0deg); | ||
} | ||
} | ||
.gelatine { | ||
animation: gelatine 0.5s infinite; | ||
} | ||
.swing { | ||
animation: swing 2s ease infinite; | ||
} | ||
.spinner { | ||
display: inline-flex; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
</script> | ||
|
||
<div class="msg"> | ||
<Spinner inline /> | ||
<Spinner /> | ||
|
||
<slot /> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters