Remove CTA button from mobile
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import Icon from '$lib/components/Icon.svelte';
|
||||
import { isMobileCtaButtonEnabled } from '$lib/feature-flags';
|
||||
|
||||
/*
|
||||
* Sticky bottom CTA shown on mobile only.
|
||||
@@ -20,6 +21,8 @@
|
||||
* to book while they're already on the form).
|
||||
*/
|
||||
|
||||
const mobileCtaButtonEnabled = isMobileCtaButtonEnabled();
|
||||
|
||||
$: pathname = $page.url.pathname;
|
||||
$: hidden = pathname === '/contact-us' || pathname === '/booking';
|
||||
|
||||
@@ -41,7 +44,7 @@
|
||||
}
|
||||
|
||||
async function setupObservers() {
|
||||
if (typeof window === 'undefined') {
|
||||
if (!mobileCtaButtonEnabled || typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,6 +87,10 @@
|
||||
}
|
||||
|
||||
afterNavigate(() => {
|
||||
if (!mobileCtaButtonEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
visible = false;
|
||||
triggerPassed = false;
|
||||
bookingInView = false;
|
||||
@@ -91,6 +98,10 @@
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
if (!mobileCtaButtonEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
void setupObservers();
|
||||
|
||||
return () => {
|
||||
@@ -99,7 +110,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if !hidden}
|
||||
{#if mobileCtaButtonEnabled && !hidden}
|
||||
<div
|
||||
class="mobile-book-bar"
|
||||
class:mobile-book-bar-visible={visible}
|
||||
|
||||
Reference in New Issue
Block a user