Skip to content

Commit

Permalink
feat(ui): fetching indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
itupix committed Feb 25, 2021
1 parent 1a568d8 commit 71315fd
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import { onMount } from 'svelte';
import { SkizzleUpdaterEnum } from 'models/skizzle';
import { clientAuthenticated } from 'shared/stores/authentication.store';
import Loader from 'components/Loader';
const app = require('electron').ipcRenderer;
let update: SkizzleUpdaterEnum;
Expand All @@ -20,7 +22,11 @@
[Views.Settings]: Settings,
};
let currentView: Views = $clientAuthenticated.isGithubAuthenticated || $clientAuthenticated.isAzureDevOpsAuthenticated ? Views.Main : Views.Accounts;
let currentView: Views =
$clientAuthenticated.isGithubAuthenticated ||
$clientAuthenticated.isAzureDevOpsAuthenticated
? Views.Main
: Views.Accounts;
const onViewChange = (view: Views) => (currentView = view);
window.addEventListener('online', () => offline.set(false));
Expand Down Expand Up @@ -54,6 +60,7 @@
{/if}
{/if}
<main style="--color:{$settings.theme}; --color-focus:{$settings.theme}80">
<Loader />
<Navigation {currentView} {onViewChange} />
<div>
<svelte:component this={views[currentView]} />
Expand Down
57 changes: 57 additions & 0 deletions src/components/Loader/Loader.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<script lang="ts">
import { isFetchingData, isLoading } from 'shared/stores/default.store';
</script>

{#if $isLoading || $isFetchingData}
<div />
{/if}

<style>
div {
animation: fadeIn 0.2s;
position: fixed;
top: 2rem;
left: 8rem;
right: 0;
overflow: hidden;
height: 0.2rem;
background-color: #4e4e4e;
border-radius: 45px;
}
div:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 50%;
height: 100%;
background-color: var(--color);
animation: loader 1.2s infinite ease-in-out;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes loader {
0% {
opacity: 0;
transform: translateX(-100%);
}
50% {
opacity: 1;
}
100% {
opacity: 0;
transform: translateX(100vw);
}
}
</style>
1 change: 1 addition & 0 deletions src/components/Loader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Loader.svelte';

0 comments on commit 71315fd

Please sign in to comment.