banner-06-block
stackzero/banner-06-blockFreeBlock
stackzero publishes no description for this item.
Install it
npx shadcn@latest add https://ui.stackzero.co/r/banner-06-block.jsonSource
1"use client";23import React, { useState, useEffect } from "react";45function Banner_06() {6 // Initial countdown time (12 hours in seconds)7 const initialTime = 12 * 60 * 60;8 const [timeLeft, setTimeLeft] = useState(initialTime);910 // Format time to HH:MM:SS11 const formatTime = (seconds: number) => {12 const hours = Math.floor(seconds / 3600);13 const minutes = Math.floor((seconds % 3600) / 60);14 const secs = seconds % 60;1516 return {17 hours: hours.toString().padStart(2, "0"),18 minutes: minutes.toString().padStart(2, "0"),19 seconds: secs.toString().padStart(2, "0"),20 };21 };2223 // Countdown effect24 useEffect(() => {25 const timer = setInterval(() => {26 setTimeLeft((prev) => (prev > 0 ? prev - 1 : 0));27 }, 1000);2829 return () => clearInterval(timer);30 }, []);3132 const time = formatTime(timeLeft);3334 return (35 <div className="relative overflow-hidden rounded-lg bg-gradient-to-r from-red-500 to-red-900 p-6 shadow-lg">36 {/* Urgency indicators */}37 <div className="absolute top-0 left-0 h-1 w-full bg-white/20">38 <div39 className="h-full bg-white transition-all duration-1000"40 style={{ width: `${(timeLeft / initialTime) * 100}%` }}41 ></div>42 </div>4344 <div className="flex flex-col items-center md:flex-row md:justify-between">45 {/* Message */}46 <div className="mb-6 md:mr-6 md:mb-0 md:w-3/5">47 <span className="mb-2 inline-block rounded-full bg-white/20 px-3 py-1 text-xs font-semibold text-white">48 HURRY UP49 </span>50 <h2 className="mb-2 text-2xl font-bold text-white md:text-3xl">51 It's Almost Gone!52 </h2>53 <p className="max-w-md text-white/80">54 Our special offer is about to expire. Get 30% off on all premium55 products before the countdown ends.56 </p>5758 <button className="mt-4 rounded-md bg-white px-6 py-2 font-medium text-red-700 transition-colors hover:bg-red-50">59 Claim Offer Now60 </button>61 </div>6263 {/* Digital Clock */}64 <div className="w-full md:w-auto">65 <div className="mb-1 text-center text-sm font-medium text-white/70">66 OFFER EXPIRES IN67 </div>68 <div className="flex items-center justify-center gap-2">69 {/* Hours */}70 <div className="flex flex-col items-center">71// … truncated
Files it writes
More from stackzero
All 112 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| address-01-blockaddress-01-block | stackzero | Blocks | Free | 4 deps | |
| address-02-blockaddress-02-block | stackzero | Blocks | Free | 4 deps | |
| address-03-blockaddress-03-block | stackzero | Blocks | Free | 4 deps | |
| banner-01-blockbanner-01-block | stackzero | Blocks | Free | no deps | |
| banner-02-blockbanner-02-block | stackzero | Blocks | Free | no deps | |
| banner-03-blockbanner-03-block | stackzero | Blocks | Free | no deps | |
| banner-04-blockbanner-04-block | stackzero | Blocks | Free | no deps | |
| banner-05-blockbanner-05-block | stackzero | Blocks | Free | no deps |
