/* eslint-disable react-x/no-array-index-key */ import { Box, Tab, Tabs } from "@mui/material"; export interface TabWidgetOption { label: string; value: E; visible: boolean; color?: string; } export function TabsWidget(p: { currTab: E; options: TabWidgetOption[]; onTabChange: (v: E) => void; }): React.ReactElement { const activeOptions = p.options.filter((v) => v.visible); const currTabIndex = activeOptions.findIndex((v) => v.value === p.currTab); const updateActiveTab = (index: number) => { p.onTabChange(activeOptions[index].value); }; return ( { updateActiveTab(newVal); }} > {activeOptions.map((o, index) => ( ))} ); }