import React from "react"; import { Tabs, Tab, Box, styled } from "@mui/material"; import CloseIcon from "@mui/icons-material/Close"; const StyledTab = styled(Tab)(({ theme }) => ({ minHeight: 48, '&.Mui-selected': { color: theme.palette.primary.main, fontWeight: theme.typography.fontWeightMedium, }, '&:focus-visible': { outline: `2px solid ${theme.palette.primary.main}`, outlineOffset: '-2px', }, })); const CustomTabs = ({ tabs, activeTab, onTabClick, onCloseTab }) => { const handleMouseDown = (e, id) => { if (e.button === 1) { // Middle mouse button e.preventDefault(); onCloseTab(id); } }; const handleChange = (event, newValue) => { onTabClick(newValue); }; return ( {/* Статические вкладки */} handleMouseDown(e, "Главная")} /> handleMouseDown(e, "Визуализация")} /> {/* Динамические вкладки */} {tabs.map((tab) => ( {tab.title} { e.stopPropagation(); onCloseTab(tab.id); }} /> } value={tab.id} onMouseDown={(e) => handleMouseDown(e, tab.id)} /> ))} ); }; export default CustomTabs;