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