Files
suwayomi-material-you-webui/src/features/core/components/tabs/TabPanel.tsx

27 lines
759 B
TypeScript
Raw Normal View History

2021-10-26 12:42:30 +03:30
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
2021-10-26 12:42:30 +03:30
2024-11-04 18:00:35 +01:00
import Box, { BoxProps } from '@mui/material/Box';
2021-10-26 12:42:30 +03:30
import React from 'react';
2024-11-04 18:00:35 +01:00
interface IProps extends BoxProps {
2021-10-26 12:42:30 +03:30
children: React.ReactNode;
index: any;
currentIndex: any;
}
2023-10-28 00:32:02 +02:00
export function TabPanel(props: IProps) {
2024-11-04 18:00:35 +01:00
const { children, index, currentIndex, ...boxProps } = props;
2021-10-26 12:42:30 +03:30
return (
2024-11-04 18:00:35 +01:00
<Box {...boxProps} role="tabpanel" hidden={index !== currentIndex} id={`simple-tabpanel-${index}`}>
2021-10-26 12:42:30 +03:30
{currentIndex === index && children}
2024-11-04 18:00:35 +01:00
</Box>
2021-10-26 12:42:30 +03:30
);
}