|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { cn } from "@ux-patterns/ui/lib/utils"; |
| 4 | +import { ArrowRight, Sparkles } from "lucide-react"; |
| 5 | +import Link from "next/link"; |
| 6 | +import { usePlausible } from "next-plausible"; |
| 7 | + |
| 8 | +type GalleryBannerProps = { |
| 9 | + title?: string; |
| 10 | + description?: string; |
| 11 | + galleryPath?: string; |
| 12 | + className?: string; |
| 13 | +}; |
| 14 | + |
| 15 | +export const GalleryBanner = ({ |
| 16 | + title = "Explore Pattern Gallery", |
| 17 | + description = "See real-world implementations and examples", |
| 18 | + galleryPath = "https://gallery.uxpatterns.dev", |
| 19 | + className, |
| 20 | +}: GalleryBannerProps) => { |
| 21 | + const plausible = usePlausible(); |
| 22 | + |
| 23 | + return ( |
| 24 | + <Link |
| 25 | + href={galleryPath} |
| 26 | + className={cn( |
| 27 | + "not-prose group relative mb-8 flex items-center justify-between rounded-lg", |
| 28 | + "border border-border/50 overflow-hidden", |
| 29 | + "px-4 py-3 transition-all duration-200", |
| 30 | + "hover:border-primary/30 hover:shadow-md", |
| 31 | + className, |
| 32 | + )} |
| 33 | + onClick={() => { |
| 34 | + plausible("Gallery Banner Click", { |
| 35 | + props: { |
| 36 | + gallery_path: galleryPath, |
| 37 | + title: title, |
| 38 | + }, |
| 39 | + }); |
| 40 | + }} |
| 41 | + > |
| 42 | + {/* Background gradient animation */} |
| 43 | + <div className="absolute inset-0 bg-gradient-to-r from-purple-500/10 via-pink-500/10 to-orange-500/10 opacity-50 group-hover:opacity-70 transition-opacity" /> |
| 44 | + |
| 45 | + {/* Animated SVG pattern */} |
| 46 | + <svg |
| 47 | + className="absolute inset-0 w-full h-full opacity-10" |
| 48 | + xmlns="http://www.w3.org/2000/svg" |
| 49 | + > |
| 50 | + <defs> |
| 51 | + <pattern |
| 52 | + id="gallery-pattern" |
| 53 | + x="0" |
| 54 | + y="0" |
| 55 | + width="40" |
| 56 | + height="40" |
| 57 | + patternUnits="userSpaceOnUse" |
| 58 | + > |
| 59 | + <circle |
| 60 | + cx="20" |
| 61 | + cy="20" |
| 62 | + r="1.5" |
| 63 | + fill="currentColor" |
| 64 | + className="text-primary" |
| 65 | + > |
| 66 | + <animate |
| 67 | + attributeName="r" |
| 68 | + values="1.5;2.5;1.5" |
| 69 | + dur="3s" |
| 70 | + repeatCount="indefinite" |
| 71 | + /> |
| 72 | + </circle> |
| 73 | + </pattern> |
| 74 | + </defs> |
| 75 | + <rect width="100%" height="100%" fill="url(#gallery-pattern)" /> |
| 76 | + </svg> |
| 77 | + |
| 78 | + <div className="relative flex items-center gap-3"> |
| 79 | + <div className="flex h-10 w-10 items-center justify-center rounded-md bg-gradient-to-br from-purple-500/20 to-pink-500/20 backdrop-blur-sm"> |
| 80 | + <Sparkles className="h-5 w-5 text-primary" /> |
| 81 | + </div> |
| 82 | + <div className="flex flex-col"> |
| 83 | + <span className="text-xs font-medium text-muted-foreground uppercase tracking-wider"> |
| 84 | + UX Patterns Gallery |
| 85 | + </span> |
| 86 | + <span className="text-sm font-semibold bg-gradient-to-r from-purple-600 to-pink-600 bg-clip-text text-transparent"> |
| 87 | + {title} |
| 88 | + </span> |
| 89 | + <span className="text-xs text-muted-foreground mt-0.5"> |
| 90 | + {description} |
| 91 | + </span> |
| 92 | + </div> |
| 93 | + </div> |
| 94 | + <ArrowRight className="relative h-4 w-4 text-muted-foreground transition-all group-hover:translate-x-1 group-hover:text-primary" /> |
| 95 | + </Link> |
| 96 | + ); |
| 97 | +}; |
0 commit comments