"use client" import { useState, useRef, useEffect } from "react" import { ChevronLeft, ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" import { useMaterial } from "@/contexts/material-context" import { cn } from "@/lib/utils" import { useTheme } from "next-themes" import { DashboardExample } from "./example-interfaces/dashboard-example" import { EcommerceExample } from "./example-interfaces/ecommerce-example" import { SocialFeedExample } from "./example-interfaces/social-feed-example" import { AdminPanelExample } from "./example-interfaces/admin-panel-example" import { MediaPlayerExample } from "./example-interfaces/media-player-example" import { MessagingAppExample } from "./example-interfaces/messaging-app-example" // Example interfaces to showcase const examples = [ { name: "Dashboard", description: "Analytics dashboard with charts and stats", component: DashboardExample, }, { name: "E-commerce", description: "Product listing with filters and cart", component: EcommerceExample, }, { name: "Social Feed", description: "Social media timeline with posts and comments", component: SocialFeedExample, }, { name: "Admin Panel", description: "User management and settings interface", component: AdminPanelExample, }, { name: "Media Player", description: "Music streaming app with playlist", component: MediaPlayerExample, }, { name: "Messaging App", description: "Chat interface with conversation list", component: MessagingAppExample, }, ] export function ExampleGallery() { const [activeIndex, setActiveIndex] = useState(0) const scrollContainerRef = useRef(null) const { selectedMaterial, getBackgroundPrimaryColor } = useMaterial() const { theme } = useTheme() // Check if the Glass material is selected const isGlassMaterial = selectedMaterial?.name === "Glass" // Get the background primary color const backgroundPrimaryColor = getBackgroundPrimaryColor() // Create a style for the cards that uses the background primary color const cardStyle = { background: isGlassMaterial ? `var(--background-primary, ${theme === "dark" ? "rgba(22, 22, 22, 0.7)" : "rgba(255, 255, 255, 0.7)"})` : "var(--background-primary)", backdropFilter: isGlassMaterial ? "blur(36px)" : "none", } const scrollToExample = (index: number) => { if (scrollContainerRef.current) { const container = scrollContainerRef.current const items = container.querySelectorAll(".example-item") if (items[index]) { container.scrollTo({ left: items[index].getBoundingClientRect().left + container.scrollLeft - container.getBoundingClientRect().left, behavior: "smooth", }) setActiveIndex(index) } } } const handleScroll = () => { if (scrollContainerRef.current) { const container = scrollContainerRef.current const items = container.querySelectorAll(".example-item") const containerLeft = container.getBoundingClientRect().left const containerCenter = containerLeft + container.offsetWidth / 2 let closestIndex = 0 let closestDistance = Number.POSITIVE_INFINITY items.forEach((item, index) => { const itemRect = item.getBoundingClientRect() const itemCenter = itemRect.left + itemRect.width / 2 const distance = Math.abs(containerCenter - itemCenter) if (distance < closestDistance) { closestDistance = distance closestIndex = index } }) if (closestIndex !== activeIndex) { setActiveIndex(closestIndex) } } } useEffect(() => { const container = scrollContainerRef.current if (container) { container.addEventListener("scroll", handleScroll) return () => container.removeEventListener("scroll", handleScroll) } }, []) return (

Example Interfaces

See how your customizations look in real-world interfaces

{examples.map((example, index) => { const ExampleComponent = example.component return (

{example.name}

{example.description}

) })}
{examples.map((_, index) => (
) }