| 1 |
/** |
| 2 |
* Section Tabs Component |
| 3 |
* Reusable tab navigation for sections with multiple tabs |
| 4 |
*/ |
| 5 |
|
| 6 |
import React from "react"; |
| 7 |
import { __ } from "../../../lib/i18n"; |
| 8 |
|
| 9 |
export interface Tab { |
| 10 |
id: string; |
| 11 |
label: string; |
| 12 |
} |
| 13 |
|
| 14 |
interface SectionTabsProps { |
| 15 |
tabs: Tab[]; |
| 16 |
activeTab: string; |
| 17 |
onTabChange: (tabId: string) => void; |
| 18 |
} |
| 19 |
|
| 20 |
export const SectionTabs: React.FC<SectionTabsProps> = ({ |
| 21 |
tabs, |
| 22 |
activeTab, |
| 23 |
onTabChange, |
| 24 |
}) => { |
| 25 |
return ( |
| 26 |
<div className="border-b border-gray-200 dark:border-gray-700 mb-4"> |
| 27 |
<div className="flex gap-1"> |
| 28 |
{tabs.map((tab) => ( |
| 29 |
<button |
| 30 |
key={tab.id} |
| 31 |
type="button" |
| 32 |
onClick={() => onTabChange(tab.id)} |
| 33 |
className={`px-4 py-2 text-sm font-medium transition-colors ${ |
| 34 |
activeTab === tab.id |
| 35 |
? "border-b-2 border-blue-600 text-blue-600 dark:text-blue-400" |
| 36 |
: "text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white" |
| 37 |
}`} |
| 38 |
> |
| 39 |
{__(tab.label, tab.label)} |
| 40 |
</button> |
| 41 |
))} |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
); |
| 45 |
}; |
| 46 |
|