tahamajs's picture
download
raw
2.8 kB
// src/components/project/ProjectTabs.tsx
import { Activity, CheckSquare, Users, FolderOpen, Calendar, Settings } from "lucide-react";
import { motion } from "framer-motion";
export type TabType = "overview" | "tasks" | "members" | "files" | "timeline" | "settings";
interface TabConfig {
id: TabType;
label: string;
icon: React.ComponentType<{ className?: string }>;
badge?: number;
}
interface ProjectTabsProps {
activeTab: TabType;
onTabChange: (tab: TabType) => void;
counts: {
tasks: number;
members: number;
files: number;
};
isOwner: boolean;
}
export function ProjectTabs({ activeTab, onTabChange, counts, isOwner }: ProjectTabsProps) {
const tabs: TabConfig[] = [
{ id: "overview", label: "Overview", icon: Activity },
{ id: "tasks", label: "Tasks", icon: CheckSquare, badge: counts.tasks },
{ id: "members", label: "Members", icon: Users, badge: counts.members },
{ id: "files", label: "Files", icon: FolderOpen, badge: counts.files },
{ id: "timeline", label: "Timeline", icon: Calendar },
];
if (isOwner) {
tabs.push({ id: "settings", label: "Settings", icon: Settings });
}
return (
<div className="border-b border-gray-200/50 dark:border-gray-700/50 bg-white/50 dark:bg-gray-900/50 backdrop-blur-md sticky top-[100px] z-10 shadow-sm">
<div className="container mx-auto px-4">
<div className="flex overflow-x-auto hide-scrollbar">
{tabs.map(tab => (
<button
key={tab.id}
onClick={() => onTabChange(tab.id)}
className={`flex items-center gap-2 px-5 py-4 text-sm font-medium transition-all relative whitespace-nowrap ${
activeTab === tab.id
? "text-primary"
: "text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
}`}
>
<tab.icon className={`w-4 h-4 ${activeTab === tab.id ? "text-primary" : ""}`} />
<span>{tab.label}</span>
{tab.badge !== undefined && tab.badge > 0 && (
<span className={`px-1.5 py-0.5 text-xs rounded-full font-semibold ${
activeTab === tab.id
? "bg-primary/10 text-primary"
: "bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400"
}`}>
{tab.badge}
</span>
)}
{activeTab === tab.id && (
<motion.div
layoutId="activeProjectTab"
className="absolute bottom-0 left-0 right-0 h-0.5 bg-gradient-to-r from-primary to-indigo-500 rounded-t-full"
/>
)}
</button>
))}
</div>
</div>
</div>
);
}

Xet Storage Details

Size:
2.8 kB
·
Xet hash:
cadeb6c6d044fa0c0fe8b3eaa719f0db0389e20aa8c15b97f39ae94131beb3e8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.