mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed } from 'vue';
|
import { type Ref, ref, onMounted } from 'vue';
|
||||||
|
|
||||||
interface Taglines {
|
interface Taglines {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -93,13 +93,22 @@ const allTaglines: { [key: string]: { design: number; taglines: Taglines[] } } =
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const { design, taglines } =
|
// Initialize with default values
|
||||||
Object.values(allTaglines)[Math.floor(Math.random() * Object.values(allTaglines).length)];
|
const design: Ref<number> = ref(1);
|
||||||
|
const taglines: Ref<Taglines[]> = ref([]);
|
||||||
|
const index: Ref<number> = ref(0);
|
||||||
|
|
||||||
let index = ref(Math.floor(Math.random() * taglines.length));
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
// Select a random variant on client side
|
||||||
|
const variant =
|
||||||
|
Object.values(allTaglines)[Math.floor(Math.random() * Object.values(allTaglines).length)];
|
||||||
|
design.value = variant.design;
|
||||||
|
taglines.value = variant.taglines;
|
||||||
|
index.value = Math.floor(Math.random() * taglines.value.length);
|
||||||
|
|
||||||
|
// Set up the interval for cycling through taglines
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
index.value = (index.value + 1) % taglines.length;
|
index.value = (index.value + 1) % taglines.value.length;
|
||||||
}, 5_000);
|
}, 5_000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -109,16 +118,17 @@ onMounted(() => {
|
|||||||
:class="[design === 1 ? 'bg-gradient-to-r from-[#bd34fe] to-[#ff3670] ' : 'bg-[#E0095F]']"
|
:class="[design === 1 ? 'bg-gradient-to-r from-[#bd34fe] to-[#ff3670] ' : 'bg-[#E0095F]']"
|
||||||
class="mb-4 w-full top-bar flex p-2"
|
class="mb-4 w-full top-bar flex p-2"
|
||||||
>
|
>
|
||||||
<p class="w-full tracking-wide fade-text">
|
<p class="w-full tracking-wide fade-text text-sm">
|
||||||
<transition name="fade" mode="out-in">
|
<transition name="fade" mode="out-in">
|
||||||
<a
|
<a
|
||||||
|
v-if="taglines.length > 0 && taglines[index]"
|
||||||
:key="index"
|
:key="index"
|
||||||
:href="taglines[index].url"
|
:href="taglines[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">{{ taglines[index].label }}</span>
|
<span class="font-semibold">{{ taglines[index].label }}</span>
|
||||||
<button class="bg-[#1E1A2E] 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>
|
||||||
</a>
|
</a>
|
||||||
|
Reference in New Issue
Block a user