asset viewer now viewing on tabs
Tabs is better for this yay Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/***********************************************************************************************************************************************************************
|
||||
* File Name : DetailTabsHeader.jsx
|
||||
* Type : Component (Generic)
|
||||
* Description : Sticky header + underline tab row for tabbed detail pages —
|
||||
* back button, icon/title/subtitle, a right-aligned actions
|
||||
* slot, and an underline tab row. Parameterized version of the
|
||||
* header in ViewPlan.jsx (modules/admin/pages/tiers/
|
||||
* ViewPlan.jsx), reused by the admin asset view pages so they
|
||||
* don't each duplicate the same markup.
|
||||
*
|
||||
* Props:
|
||||
* icon {Component} – lucide icon rendered before the title
|
||||
* title {string}
|
||||
* subtitle {string}
|
||||
* actions {ReactNode} – right-aligned buttons (e.g. Edit)
|
||||
* onBack {function}
|
||||
* tabs {Array<{ key, label, icon }>}
|
||||
* activeTab {string}
|
||||
* onTabChange{function}
|
||||
***********************************************************************************************************************************************************************/
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export default function DetailTabsHeader({
|
||||
icon: Icon, title, subtitle, actions, onBack, tabs, activeTab, onTabChange,
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className="sticky z-20 shrink-0 border-b bg-white/70 dark:bg-zinc-900/70 backdrop-blur-md"
|
||||
style={{ top: "var(--navbar-h)" }}
|
||||
>
|
||||
<div className="lg:container lg:mx-auto lg:px-6 px-4">
|
||||
<div className="flex items-center gap-3 py-3">
|
||||
<Button type="button" variant="ghost" size="icon" onClick={onBack}>
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h1 className="text-xl font-semibold leading-tight flex items-center gap-2">
|
||||
{Icon && <Icon className="h-5 w-5 text-muted-foreground" />}
|
||||
{title}
|
||||
</h1>
|
||||
{subtitle && <p className="text-sm text-muted-foreground">{subtitle}</p>}
|
||||
</div>
|
||||
{actions}
|
||||
</div>
|
||||
|
||||
{/* Underline tabs */}
|
||||
<div className="flex gap-1 pb-0 -mb-px">
|
||||
{tabs.map(({ key, label, icon: TabIcon }) => (
|
||||
<button
|
||||
key={key}
|
||||
onClick={() => onTabChange(key)}
|
||||
className={[
|
||||
"flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",
|
||||
activeTab === key
|
||||
? "border-primary text-primary"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground",
|
||||
].join(" ")}
|
||||
>
|
||||
<TabIcon className="h-3.5 w-3.5" />
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user