gdpr audit implemented, email log, vollmachten, pdf delete cancel data privacy and vollmachten, removed message no id card in engergy car, and other contracts that are not telecom contracts, added insert counter for engery
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ReactNode, useState } from 'react';
|
||||
import { ReactNode, useState, useEffect } from 'react';
|
||||
|
||||
interface Tab {
|
||||
id: string;
|
||||
@@ -9,10 +9,24 @@ interface Tab {
|
||||
interface TabsProps {
|
||||
tabs: Tab[];
|
||||
defaultTab?: string;
|
||||
activeTab?: string;
|
||||
onTabChange?: (tabId: string) => void;
|
||||
}
|
||||
|
||||
export default function Tabs({ tabs, defaultTab }: TabsProps) {
|
||||
const [activeTab, setActiveTab] = useState(defaultTab || tabs[0]?.id);
|
||||
export default function Tabs({ tabs, defaultTab, activeTab: controlledTab, onTabChange }: TabsProps) {
|
||||
const [internalTab, setInternalTab] = useState(defaultTab || tabs[0]?.id);
|
||||
const activeTab = controlledTab ?? internalTab;
|
||||
|
||||
useEffect(() => {
|
||||
if (controlledTab !== undefined) {
|
||||
setInternalTab(controlledTab);
|
||||
}
|
||||
}, [controlledTab]);
|
||||
|
||||
const handleTabChange = (tabId: string) => {
|
||||
setInternalTab(tabId);
|
||||
onTabChange?.(tabId);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -21,7 +35,7 @@ export default function Tabs({ tabs, defaultTab }: TabsProps) {
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
onClick={() => handleTabChange(tab.id)}
|
||||
className={`py-4 px-1 border-b-2 font-medium text-sm whitespace-nowrap ${
|
||||
activeTab === tab.id
|
||||
? 'border-blue-500 text-blue-600'
|
||||
|
||||
Reference in New Issue
Block a user