Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

feat(nc-gui): add slide animation

Ramesh Mane55fb39756476
diff --git a/packages/nc-gui/components/auth/onboarding/Layout/index.vue b/packages/nc-gui/components/auth/onboarding/Layout/index.vue
index b67696be6a..c4a705d45f 100644
--- a/packages/nc-gui/components/auth/onboarding/Layout/index.vue
+++ b/packages/nc-gui/components/auth/onboarding/Layout/index.vue
@@ -49,7 +49,7 @@ useEventListener('keydown', (event) => {
class="w-full lg:(w-1/2) transition-width duration-250 h-full flex flex-col gap-[120px] nc-scrollbar-thin relative border-l-1 border-nc-border-gray-medium"
>
<header
- class="px-4 pt-6 lg:(pt-12 px-8) flex items-center justify-between w-full max-w-[672px] lg:max-w-[704px] mx-auto sticky top-0 lg:-top-4 bg-white"
+ class="px-4 pt-6 lg:(pt-12 px-8) flex items-center justify-between w-full max-w-[672px] lg:max-w-[704px] mx-auto sticky top-0 lg:-top-4 bg-white z-10"
>
<GeneralIcon icon="nocodb1" class="w-12 h-12 flex-none" />
@@ -70,7 +70,7 @@ useEventListener('keydown', (event) => {
<slot name="footer">
<footer
- class="flex flex-col justify-end w-full max-w-[672px] lg:max-w-[704px] mx-auto px-4 pb-6 lg:(pb-12 px-8) sticky bottom-0 bg-white"
+ class="flex flex-col justify-end w-full max-w-[672px] lg:max-w-[704px] mx-auto px-4 pb-6 lg:(pb-12 px-8) sticky bottom-0 bg-white z-10"
>
<div
class="flex items-center"
diff --git a/packages/nc-gui/components/auth/onboarding/index.vue b/packages/nc-gui/components/auth/onboarding/index.vue
index 8473b4c835..b5a3abea57 100644
--- a/packages/nc-gui/components/auth/onboarding/index.vue
+++ b/packages/nc-gui/components/auth/onboarding/index.vue
@@ -11,6 +11,17 @@ const onSelectRef: VNodeRef = (el) => {
}
}
+const transitionName = ref<'slide-left' | 'slide-right' | null>(null)
+
+watch(
+ () => stepper.index.value,
+ (newIndex, oldIndex) => {
+ if (oldIndex === undefined) return
+
+ transitionName.value = newIndex > (oldIndex ?? 0) ? 'slide-left' : 'slide-right'
+ },
+)
+
let timer: any
watch(
() => visibleQuestion.value.id,
@@ -43,9 +54,59 @@ onMounted(() => {
<template>
<AuthOnboardingLayout>
<template #content>
- <AuthOnboardingQuestion :question="visibleQuestion" :question-index="stepper.index.value" :ref="onSelectRef" />
+ <div class="relative w-full">
+ <Transition :name="transitionName ?? ''" mode="out-in">
+ <AuthOnboardingQuestion
+ :key="stepper.index.value"
+ :question="visibleQuestion"
+ :question-index="stepper.index.value"
+ :ref="onSelectRef"
+ />
+ </Transition>
+ </div>
</template>
</AuthOnboardingLayout>
</template>
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.slide-left-enter-active,
+.slide-right-enter-active,
+.slide-left-leave-active,
+.slide-right-leave-active {
+ transition: all 0.3s ease;
+}
+
+.slide-left-enter-from {
+ opacity: 0;
+ transform: translateX(100%);
+}
+.slide-left-enter-to {
+ opacity: 1;
+ transform: translateX(0);
+}
+.slide-left-leave-from {
+ opacity: 1;
+ transform: translateX(0);
+}
+.slide-left-leave-to {
+ opacity: 0;
+ transform: translateX(-100%);
+}
+
+.slide-right-enter-from {
+ opacity: 0;
+ transform: translateX(-100%);
+}
+.slide-right-enter-to {
+ opacity: 1;
+ transform: translateX(0);
+}
+.slide-right-leave-from {
+ opacity: 1;
+ transform: translateX(0);
+}
+.slide-right-leave-to {
+ opacity: 0;
+ transform: translateX(100%);
+}
+</style>