From c9b06247fa615f3b4880ce1a92521e8100e2e008 Mon Sep 17 00:00:00 2001 From: kudinDmitriyUp Date: Mon, 8 Jun 2026 12:42:51 +0000 Subject: [PATCH] Bob AI: Added a promotional section with a countdown timer. --- src/pages/HomePage.tsx | 4 +- src/pages/HomePage/sections/Promo.tsx | 92 +++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/pages/HomePage/sections/Promo.tsx diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 7f04492..5c54973 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -14,7 +14,8 @@ import FaqSection from './HomePage/sections/Faq'; import ContactSection from './HomePage/sections/Contact'; -{/* webild-stub @2026-06-08T10:52:22.393Z: To the top right of the Our Story section image add a 5 min timer countdown to opt in to a disocunt for today */} + +import PromoSection from './HomePage/sections/Promo';{/* webild-stub @2026-06-08T10:52:22.393Z: To the top right of the Our Story section image add a 5 min timer countdown to opt in to a disocunt for today */} export default function HomePage(): React.JSX.Element { return ( @@ -22,6 +23,7 @@ export default function HomePage(): React.JSX.Element { + diff --git a/src/pages/HomePage/sections/Promo.tsx b/src/pages/HomePage/sections/Promo.tsx new file mode 100644 index 0000000..97c0b2b --- /dev/null +++ b/src/pages/HomePage/sections/Promo.tsx @@ -0,0 +1,92 @@ +import { useState, useEffect } from "react"; +import { motion } from "motion/react"; +import Button from "@/components/ui/Button"; + +export default function PromoSection() { + const [timeLeft, setTimeLeft] = useState({ hours: 5, minutes: 0, seconds: 0 }); + + useEffect(() => { + const timer = setInterval(() => { + setTimeLeft((prev) => { + if (prev.hours === 0 && prev.minutes === 0 && prev.seconds === 0) { + clearInterval(timer); + return prev; + } + let newSeconds = prev.seconds - 1; + let newMinutes = prev.minutes; + let newHours = prev.hours; + + if (newSeconds < 0) { + newSeconds = 59; + newMinutes -= 1; + } + if (newMinutes < 0) { + newMinutes = 59; + newHours -= 1; + } + + return { hours: newHours, minutes: newMinutes, seconds: newSeconds }; + }); + }, 1000); + + return () => clearInterval(timer); + }, []); + + return ( +
+
+ + + Limited Time Offer + +

+ Get 20% Off Your First Order +

+

+ Experience the taste of freshly baked goodness. Claim your discount before the timer runs out! +

+ +
+
+
+ {String(timeLeft.hours).padStart(2, '0')} +
+ Hours +
+
:
+
+
+ {String(timeLeft.minutes).padStart(2, '0')} +
+ Mins +
+
:
+
+
+ {String(timeLeft.seconds).padStart(2, '0')} +
+ Secs +
+
+ +
+ + {/* Decorative background elements */} +
+
+
+
+
+ ); +} \ No newline at end of file -- 2.49.1