diff --git a/bun.lock b/bun.lock index a836268..8b4bc7a 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "superrevive", diff --git a/src/components/molecules/StickySupportBanner.tsx b/src/components/molecules/StickySupportBanner.tsx new file mode 100644 index 0000000..645262f --- /dev/null +++ b/src/components/molecules/StickySupportBanner.tsx @@ -0,0 +1,135 @@ +import { Button } from "@/components/ui/button"; +import { useIsMobile } from "@/hooks/use-mobile"; +import { getContactLink, getPhoneNumber } from "@/lib/constants"; +import { cn } from "@/lib/utils"; +import { useState } from "react"; + +const StickySupportBanner = () => { + const [isOpen, _] = useState(true); + const isMobile = useIsMobile(); + const contactLink = getContactLink("default"); + const phoneNumber = getPhoneNumber("default"); + + if (!isOpen) return null; + + return ( +
+
+ {/* Header section */} +
+ + + Need Help?{" "} + + + We're Here For You + + +
+ + {/* Center section with logo */} +
+ Spectrum Support +

+ Get the best Spectrum deals with zero hassle. Our team + handles everything from setup to billing. +

+ + + {phoneNumber} + + + + + +
+ + {/* Footer section */} +
+ + Get the best Spectrum deals with zero hassle—call now! + +
+
+
+ ); +}; + +export default StickySupportBanner; diff --git a/src/hooks/use-mobile.tsx b/src/hooks/use-mobile.tsx new file mode 100644 index 0000000..bd6317d --- /dev/null +++ b/src/hooks/use-mobile.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; + +const MOBILE_BREAKPOINT = 768; + +export function useIsMobile() { + const [isMobile, setIsMobile] = React.useState( + undefined, + ); + + React.useEffect(() => { + const mql = window.matchMedia( + `(max-width: ${MOBILE_BREAKPOINT - 1}px)`, + ); + const onChange = () => { + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); + }; + mql.addEventListener("change", onChange); + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); + return () => mql.removeEventListener("change", onChange); + }, []); + + return !!isMobile; +} diff --git a/src/pages/index.astro b/src/pages/index.astro index d8e577c..8933ff9 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -12,7 +12,7 @@ import Stats from "@/components/Stats.astro"; import Testimonials from "@/components/Testimonials.astro"; import Packages from "@/components/Packages.astro"; import { cn } from "@/lib/utils"; -import { CONTACT_EMAIL, getContactLink } from "@/lib/constants"; +import { getContactLink } from "@/lib/constants"; import { Wifi, Tv, @@ -24,6 +24,7 @@ import { Headphones, } from "lucide-react"; import CallButton from "@/components/molecules/CallButton"; +import StickySupportBanner from "@/components/molecules/StickySupportBanner"; const page = "default"; --- @@ -563,6 +564,7 @@ const page = "default";