diff --git a/lib/components/Tabs/TabTitle.tsx b/lib/components/Tabs/TabTitle.tsx index f630590d..34e62772 100644 --- a/lib/components/Tabs/TabTitle.tsx +++ b/lib/components/Tabs/TabTitle.tsx @@ -10,13 +10,13 @@ export type TabTitleProps = { title: string; className?: string; variant: 'primary' | 'secondary'; - onClickHandler?: () => void; + onChange?: () => void; }; -const TabTitle = ({ icon, activeTab, isActive, setSelectedTab, title,className,variant, onClickHandler }: TabTitleProps) => { +const TabTitle = ({ icon, activeTab, isActive, setSelectedTab, title,className,variant, onChange }: TabTitleProps) => { const handleOnClick = useCallback((title: string) => { setSelectedTab(title); - onClickHandler?.(); + onChange?.(); }, [setSelectedTab, activeTab]); const classNameVariants: Record = { diff --git a/lib/components/Tabs/Tabs.tsx b/lib/components/Tabs/Tabs.tsx index 2d677e18..34d1c7fc 100644 --- a/lib/components/Tabs/Tabs.tsx +++ b/lib/components/Tabs/Tabs.tsx @@ -9,16 +9,16 @@ type TabsProps = { wrapperClassName?: string; className?: string; variant?: 'primary' | 'secondary'; - onClickHandler?: () => void; + onChange?: (index: number) => void; }; -const Tabs = ({ children, activeTab, wrapperClassName, className, variant = 'primary', onClickHandler }: TabsProps): JSX.Element => { +const Tabs = ({ children, activeTab, wrapperClassName, className, variant = 'primary', onChange }: TabsProps): JSX.Element => { const [selectedTab, setSelectedTab] = useState(activeTab || children[0].props.title); return (
- {children.map((item) => { + {children.map((item, index) => { return ( button this is a Text - + console.log(index)} > test data for tab 1