Merge pull request #1742 from mermaid-js/rajat-ht/chore-update-banner-ad
Chore: Update banner ad
This commit is contained in:
@@ -21,37 +21,6 @@
|
||||
|
||||
const commonParams = { utm_source: C.utmSource, utm_medium: 'banner_ad' } as const;
|
||||
|
||||
const randomTagLines: Taglines[] = [
|
||||
{
|
||||
label: 'Customize your layout and design in Mermaid Chart’s whiteboard!',
|
||||
url: {
|
||||
path: '/whiteboard',
|
||||
params: { utm_campaign: 'whiteboard' }
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Customize your layout and design in Mermaid Chart’s visual editor!',
|
||||
url: {
|
||||
path: '/whiteboard',
|
||||
params: { utm_campaign: 'visual_editor' }
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Customize your layout and design with Mermaid Chart’s GUI!',
|
||||
url: {
|
||||
path: '/whiteboard',
|
||||
params: { utm_campaign: 'gui' }
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Customize your layout and design in Mermaid Chart!',
|
||||
url: {
|
||||
path: '/whiteboard',
|
||||
params: { utm_campaign: 'visual_editor_whiteboard_gui' }
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
let taglines: Taglines[] = [
|
||||
{
|
||||
label: 'Replace ChatGPT Pro, Mermaid.live, and Lucid Chart with Mermaid Chart',
|
||||
@@ -66,33 +35,25 @@
|
||||
path: '/landing',
|
||||
params: { utm_campaign: 'team_collaboration' }
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Customize your layout and design in Mermaid Chart’s visual editor!',
|
||||
url: {
|
||||
path: '/whiteboard',
|
||||
params: { utm_campaign: 'visual_editor' }
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
const getRandomIndex = (array: unknown[]) => Math.floor(Math.random() * array.length);
|
||||
const getSessionHeadlineIndex = (): number => {
|
||||
const storageKey = 'mermaidBannerIndex';
|
||||
const storedIndex = sessionStorage.getItem(storageKey);
|
||||
|
||||
if (storedIndex) {
|
||||
return Number.parseInt(storedIndex, 10);
|
||||
}
|
||||
|
||||
const randomIndex = getRandomIndex(randomTagLines);
|
||||
sessionStorage.setItem(storageKey, randomIndex.toString());
|
||||
return randomIndex;
|
||||
};
|
||||
|
||||
const selectedHeadlineIndex = getSessionHeadlineIndex();
|
||||
const currentBannerSet = [...taglines, randomTagLines[selectedHeadlineIndex]];
|
||||
|
||||
let index = $state(getRandomIndex(currentBannerSet));
|
||||
let currentTagline = $derived(currentBannerSet[index]);
|
||||
let index = $state(getRandomIndex(taglines));
|
||||
let currentTagline = $derived(taglines[index]);
|
||||
let shouldAnimate = $state(true);
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if (shouldAnimate) {
|
||||
index = (index + 1) % currentBannerSet.length;
|
||||
index = (index + 1) % taglines.length;
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
@@ -117,9 +78,9 @@
|
||||
class="col-start-1 row-start-1 flex items-center justify-center gap-4 no-underline"
|
||||
in:fade={{ delay: 800 }}
|
||||
out:fade={{ duration: 1000 }}>
|
||||
<span class="text-sm tracking-wider text-white">{currentTagline.label}</span>
|
||||
<span class="text-base tracking-wider text-white">{currentTagline.label}</span>
|
||||
<Button
|
||||
class="shrink-0 rounded-md bg-[#1E1A2E] px-3 py-1.5 text-sm font-semibold tracking-wide text-white hover:bg-[#261A56]">
|
||||
class="shrink-0 rounded-md bg-[#1E1A2E] px-3 py-1.5 text-base font-semibold tracking-wide text-white hover:bg-[#261A56]">
|
||||
Try now
|
||||
</Button>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user