Skip to content

Commit

Permalink
add transitions in the main loading
Browse files Browse the repository at this point in the history
  • Loading branch information
rouk1 committed Jul 17, 2024
1 parent 93df841 commit bed3e61
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
26 changes: 20 additions & 6 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,26 @@ import LoadingBars from "./components/LoadingBars.vue";
<template>
<RouterView v-slot="{ Component }">
<template v-if="Component">
<Suspense>
<component :is="Component" />
<template #fallback>
<LoadingBars />
</template>
</Suspense>
<Transition name="fade">
<Suspense>
<component :is="Component" />
<template #fallback>
<div class="loader">
<LoadingBars />
</div>
</template>
</Suspense>
</Transition>
</template>
</RouterView>
</template>

<style scoped>
.loader {
display: flex;
width: 100dvw;
height: 100dvh;
align-items: center;
justify-content: center;
}
</style>
9 changes: 9 additions & 0 deletions frontend/src/assets/styles/_animations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease-in-out;
}

.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
1 change: 1 addition & 0 deletions frontend/src/assets/styles/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import url("./_reset.css");
@import url("./_variables.css");
@import url("./_typography.css");
@import url("./_animations.css");
2 changes: 1 addition & 1 deletion frontend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./assets/styles/main.css";

import { createApp } from "vue";
import { createPinia } from "pinia";
import { createApp } from "vue";

import App from "./App.vue";
import router from "./router";
Expand Down
8 changes: 4 additions & 4 deletions frontend/tests/views/dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from "vitest";
import { useRoute } from "vue-router";
import { mountSuspens, mockedFecth, createFetchResponse } from "../test.utils";
import DashboardView from "@/views/DashboardView.vue";
import FileTree from "@/components/FileTree.vue";
import DashboardView from "@/views/DashboardView.vue";
import { describe, expect, it, vi } from "vitest";
import { useRoute } from "vue-router";
import { createFetchResponse, mockedFecth, mountSuspens } from "../test.utils";

vi.mock("vue-router", () => ({
useRoute: vi.fn(),
Expand Down

0 comments on commit bed3e61

Please sign in to comment.