|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { useState } from "react"; |
| 4 | +import { AppShell, Header, Content, HeaderNav, HeaderNavItem, MotionProvider, cn } from "@appshell/react"; |
| 5 | +import { framerMotionAdapter } from "@appshell/react/motion-framer"; |
| 6 | +import { Search, Bell, User, Clock, ArrowRight, TrendingUp, Bookmark, LayoutGrid, List, Info } from "lucide-react"; |
| 7 | + |
| 8 | +export default function StickyTabsPage() { |
| 9 | + const [activeTab, setActiveTab] = useState("overview"); |
| 10 | + |
| 11 | + return ( |
| 12 | + <MotionProvider adapter={framerMotionAdapter}> |
| 13 | + <AppShell safeArea> |
| 14 | + <Header |
| 15 | + behavior="fixed" |
| 16 | + theme="light" |
| 17 | + logo={ |
| 18 | + <div className="flex items-center gap-2"> |
| 19 | + <div className="size-8 rounded-lg bg-primary flex items-center justify-center"> |
| 20 | + <LayoutGrid className="size-5 text-primary-foreground" /> |
| 21 | + </div> |
| 22 | + <span className="text-lg font-bold tracking-tight">Console</span> |
| 23 | + </div> |
| 24 | + } |
| 25 | + nav={ |
| 26 | + <HeaderNav> |
| 27 | + <HeaderNavItem label="Dashboard" active /> |
| 28 | + <HeaderNavItem label="Resources" /> |
| 29 | + <HeaderNavItem label="Activity" /> |
| 30 | + </HeaderNav> |
| 31 | + } |
| 32 | + actions={ |
| 33 | + <div className="flex items-center gap-1"> |
| 34 | + <button |
| 35 | + type="button" |
| 36 | + className="rounded-lg p-2 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors" |
| 37 | + > |
| 38 | + <Search className="size-5" /> |
| 39 | + </button> |
| 40 | + <button |
| 41 | + type="button" |
| 42 | + className="rounded-lg p-2 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors" |
| 43 | + > |
| 44 | + <Bell className="size-5" /> |
| 45 | + </button> |
| 46 | + <div className="size-8 rounded-full bg-accent ml-2 flex items-center justify-center"> |
| 47 | + <User className="size-5 text-muted-foreground" /> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + } |
| 51 | + title="Project Infrastructure" |
| 52 | + subtitle="Manage your cloud resources and deployment pipelines" |
| 53 | + /> |
| 54 | + |
| 55 | + <Content className="pb-20"> |
| 56 | + {/* Hero Section */} |
| 57 | + <div className="w-full h-48 bg-gradient-to-r from-blue-600 to-indigo-700 relative overflow-hidden"> |
| 58 | + <div className="absolute inset-0 opacity-10"> |
| 59 | + <div className="absolute top-0 left-0 w-full h-full bg-[radial-gradient(circle_at_center,_var(--tw-gradient-stops))] from-white via-transparent to-transparent scale-150" /> |
| 60 | + </div> |
| 61 | + <div className="absolute inset-0 flex items-center justify-center text-white/20"> |
| 62 | + <LayoutGrid className="size-32" /> |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + |
| 66 | + {/* Sticky Tabs Bar */} |
| 67 | + <div className="sticky top-[112px] z-40 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 px-4 sm:px-6"> |
| 68 | + <div className="mx-auto max-w-7xl"> |
| 69 | + <div className="flex h-12 items-center gap-6 overflow-x-auto no-scrollbar"> |
| 70 | + {[ |
| 71 | + { id: "overview", label: "Overview", icon: Info }, |
| 72 | + { id: "resources", label: "Resources", icon: LayoutGrid }, |
| 73 | + { id: "logs", label: "Logs", icon: List }, |
| 74 | + { id: "settings", label: "Settings", icon: Bell }, |
| 75 | + ].map((tab) => ( |
| 76 | + <button |
| 77 | + key={tab.id} |
| 78 | + onClick={() => setActiveTab(tab.id)} |
| 79 | + className={cn( |
| 80 | + "inline-flex items-center gap-2 border-b-2 px-1 pb-3 pt-4 text-sm font-medium transition-all hover:text-foreground", |
| 81 | + activeTab === tab.id |
| 82 | + ? "border-primary text-foreground" |
| 83 | + : "border-transparent text-muted-foreground hover:border-border" |
| 84 | + )} |
| 85 | + > |
| 86 | + <tab.icon className="size-4" /> |
| 87 | + {tab.label} |
| 88 | + </button> |
| 89 | + ))} |
| 90 | + </div> |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + |
| 94 | + {/* Page Content */} |
| 95 | + <div className="mx-auto max-w-7xl px-4 sm:px-6 py-8"> |
| 96 | + <div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3"> |
| 97 | + {Array.from({ length: 12 }).map((_, i) => ( |
| 98 | + <div |
| 99 | + key={i} |
| 100 | + className="group rounded-xl border bg-card p-6 text-card-foreground shadow-sm transition-all hover:shadow-md" |
| 101 | + > |
| 102 | + <div className="mb-4 flex items-center justify-between"> |
| 103 | + <div className="size-10 rounded-lg bg-blue-500/10 flex items-center justify-center text-blue-600"> |
| 104 | + <LayoutGrid className="size-6" /> |
| 105 | + </div> |
| 106 | + <div className="flex items-center gap-1.5 rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-xs font-medium text-emerald-600"> |
| 107 | + <span className="size-1.5 rounded-full bg-emerald-500" /> |
| 108 | + Running |
| 109 | + </div> |
| 110 | + </div> |
| 111 | + <h3 className="text-lg font-semibold leading-none tracking-tight"> |
| 112 | + Resource Instance {i + 1} |
| 113 | + </h3> |
| 114 | + <p className="mt-2 text-sm text-muted-foreground leading-relaxed"> |
| 115 | + Standard high-performance instance deployed in Region us-east-1. |
| 116 | + Optimized for compute-intensive workloads. |
| 117 | + </p> |
| 118 | + <div className="mt-6 flex items-center justify-between pt-4 border-t"> |
| 119 | + <div className="text-xs text-muted-foreground font-mono"> |
| 120 | + i-0a8f92b{i} |
| 121 | + </div> |
| 122 | + <button className="text-xs font-medium text-primary hover:underline flex items-center gap-1"> |
| 123 | + Manage <ArrowRight className="size-3" /> |
| 124 | + </button> |
| 125 | + </div> |
| 126 | + </div> |
| 127 | + ))} |
| 128 | + </div> |
| 129 | + </div> |
| 130 | + </Content> |
| 131 | + |
| 132 | + {/* Behavior indicator */} |
| 133 | + <div className="fixed bottom-4 left-4 z-50 flex flex-col gap-2 rounded-2xl bg-zinc-950/90 p-3 text-white/90 shadow-2xl backdrop-blur-md border border-white/10 sm:flex-row sm:items-center sm:rounded-full sm:px-4 sm:py-2"> |
| 134 | + <div className="flex items-center gap-2 text-[11px] font-mono whitespace-nowrap border-b border-white/10 pb-2 sm:border-b-0 sm:pb-0 sm:pr-3 sm:border-r sm:mr-1"> |
| 135 | + <span className="size-2 rounded-full bg-blue-500 animate-pulse" /> |
| 136 | + HEADER: behavior="fixed" |
| 137 | + </div> |
| 138 | + <div className="flex items-center gap-2 text-[11px] font-mono whitespace-nowrap"> |
| 139 | + <span className="size-2 rounded-full bg-emerald-500" /> |
| 140 | + TABS: sticky top-[112px] |
| 141 | + </div> |
| 142 | + </div> |
| 143 | + </AppShell> |
| 144 | + </MotionProvider> |
| 145 | + ); |
| 146 | +} |
0 commit comments