import { RawParams, useCurrentStateAndParams } from '@uirouter/react';
import { ReactNode } from 'react';
import { Icon } from '@@/Icon';
import { Link } from '@@/Link';
import { Tabs } from '@@/primitives/Tabs/Tabs';
export interface Tab {
name: ReactNode;
icon?: ReactNode;
widget: ReactNode;
selectedTabParam: string;
}
interface Props {
currentTabIndex: number;
tabs: Tab[];
useContainer?: boolean;
ariaLabel?: string;
}
export function WidgetTabs({
currentTabIndex,
tabs,
useContainer = true,
ariaLabel = 'Section navigation',
}: Props) {
const invalidQueryParamValue = tabs.some(
(tab) => encodeURIComponent(tab.selectedTabParam) !== tab.selectedTabParam
);
if (invalidQueryParamValue) {
throw new Error('Invalid query param value for tab');
}
const tabsComponent = (