chore: update as per suggestion

This commit is contained in:
rajat-ht
2025-05-06 03:30:49 +05:30
parent 02ff3c1216
commit 5d61a30237

View File

@@ -37,13 +37,10 @@ const randomTagLines: Taglines[] = [
]; ];
const index: Ref<number> = ref(0); const index: Ref<number> = ref(0);
const currentBannerSet = ref<Taglines[]>(taglines); const currentBannerSet: Ref<Taglines[]> = ref(taglines);
console.log('currentBannerSet:', currentBannerSet.value);
onMounted(() => { onMounted(() => {
const newIndex = Math.floor(Math.random() * randomTagLines.length); const newIndex = Math.floor(Math.random() * randomTagLines.length);
console.log('newIndex:', newIndex);
currentBannerSet.value = [...taglines, randomTagLines[newIndex]]; currentBannerSet.value = [...taglines, randomTagLines[newIndex]];
index.value = Math.floor(Math.random() * currentBannerSet.value.length); index.value = Math.floor(Math.random() * currentBannerSet.value.length);
setInterval(() => { setInterval(() => {
@@ -58,11 +55,11 @@ onMounted(() => {
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<a <a
:key="index" :key="index"
:href="currentBannerSet?.[index]?.url" :href="currentBannerSet[index].url"
target="_blank" target="_blank"
class="unstyled flex justify-center items-center gap-4 text-white tracking-wide plausible-event-name=bannerClick" class="unstyled flex justify-center items-center gap-4 text-white tracking-wide plausible-event-name=bannerClick"
> >
<span class="font-semibold">{{ currentBannerSet?.[index]?.label }}</span> <span class="font-semibold">{{ currentBannerSet[index].label }}</span>
<button class="bg-[#1E1A2E] shrink-0 rounded-lg p-1.5 px-4 font-semibold tracking-wide"> <button class="bg-[#1E1A2E] shrink-0 rounded-lg p-1.5 px-4 font-semibold tracking-wide">
Try now Try now
</button> </button>