banner-07-block
stackzero/banner-07-blockFreeBlock
stackzero publishes no description for this item.
Install it
npx shadcn@latest add https://ui.stackzero.co/r/banner-07-block.jsonSource
1"use client";2import React, { useState, useEffect } from "react";3import NumberFlow, { NumberFlowGroup } from "@number-flow/react";45function Banner_07() {6 // State to track countdown time7 const [timeLeft, setTimeLeft] = useState({8 hours: 24,9 minutes: 0,10 seconds: 0,11 });1213 useEffect(() => {14 // Calculate expiry time (24 hours from now)15 const expiry = new Date();16 expiry.setHours(expiry.getHours() + 24);1718 // Update countdown every second19 const timer = setInterval(() => {20 const now = new Date();21 const difference = expiry.getTime() - now.getTime();2223 // Stop timer when countdown reaches 024 if (difference <= 0) {25 clearInterval(timer);26 setTimeLeft({ hours: 0, minutes: 0, seconds: 0 });27 return;28 }2930 // Calculate hours, minutes, seconds31 const hours = Math.floor(difference / (1000 * 60 * 60));32 const minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60));33 const seconds = Math.floor((difference % (1000 * 60)) / 1000);3435 setTimeLeft({ hours, minutes, seconds });36 }, 1000);3738 // Clean up timer39 return () => clearInterval(timer);40 }, []);4142 return (43 <div className="relative overflow-hidden rounded-xl bg-gradient-to-br from-indigo-900 via-violet-800 to-purple-900 p-8">44 {/* Decorative background elements */}45 <div className="absolute inset-0 opacity-20">46 <div className="absolute -top-20 -right-20 h-64 w-64 rounded-full bg-fuchsia-500 blur-3xl"></div>47 <div className="absolute -bottom-32 -left-20 h-80 w-80 rounded-full bg-blue-600 blur-3xl"></div>48 </div>4950 <div className="relative z-10">51 <div className="mx-auto text-center">52 <div className="inline-block rounded-lg bg-white/10 px-4 py-1 text-sm font-semibold tracking-wider text-white uppercase backdrop-blur-sm">53 Flash Sale54 </div>5556 <h2 className="mt-4 text-3xl font-bold text-white md:text-4xl">57 Don't miss your chance to save!58 </h2>5960 <p className="mx-auto mt-2 max-w-2xl text-purple-100">61 Our biggest discount of the season on all premium items. When the62 counter reaches zero, the prices go back to normal.63 </p>6465 {/* Counter section with NumberFlow */}66 <div className="mt-8 flex flex-col items-center justify-center">67 <p className="mb-2 text-sm font-medium text-purple-200">68// … truncated
What it pulls in
npm packages
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 |
