From 23e4e0d9a4fb9cf002bbbdcc3b2356dea1dc68a6 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 31 Jul 2023 16:47:06 +0530 Subject: [PATCH] fix: added slide animation to tab active indicator --- frontend/src/pages/Lead.vue | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index f020a86e..a5e6f8c0 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -54,26 +54,28 @@ +
@@ -137,8 +139,9 @@ import { FeatherIcon, Dropdown, } from 'frappe-ui' +import { TransitionPresets, useTransition } from '@vueuse/core' import { usersStore } from '../stores/users' -import { computed } from 'vue' +import { ref, computed } from 'vue' const { getUser } = usersStore() @@ -177,6 +180,21 @@ const tabs = [ }, ] +const tabRef = ref([]) +const indicator = ref(null) + +let indicatorLeft = ref(20) +const indicatorLeftValue = useTransition(indicatorLeft, { + duration: 250, + ease: TransitionPresets.easeOutCubic, +}) + +const moveIndicator = (index) => { + const selectedTab = tabRef.value[index].el + indicator.value.style.width = `${selectedTab.offsetWidth}px` + indicatorLeft.value = selectedTab.offsetLeft +} + const statusDropdownOptions = [ { label: 'New',