Files
pgadmin4/web/pgadmin/static/js/components/TabPanel.jsx
Yogesh Mahajan 102e0a9839 - Update MUI v4 to v5
- Remove the SCSS dependency completely and use MUI for theming.
- Update - date-fns, @date-io, notistack. Remove - popper.js, sass-loader.
- Cleanup webpack config.
- Port PSQL tool to use MUI themes instead of SCSS theme.
- Theme change will reflect realtime without refreshing pgAdmin.
2024-04-09 08:21:14 +05:30

44 lines
1.3 KiB
JavaScript

/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import React from 'react';
import { Box } from '@mui/material';
import { makeStyles } from '@mui/styles';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import CustomPropTypes from '../custom_prop_types';
export const tabPanelStyles = makeStyles((theme)=>({
root: {
...theme.mixins.tabPanel,
},
content: {
height: '100%',
}
}));
/* Material UI does not have any tabpanel component, we create one for us */
export default function TabPanel({children, classNameRoot, className, value, index, ...props}) {
const classes = tabPanelStyles();
const active = value === index;
return (
<Box className={clsx(classes.root, classNameRoot)} component="div" hidden={!active} data-test="tabpanel" {...props}>
<Box className={clsx(classes.content, className)}>{children}</Box>
</Box>
);
}
TabPanel.propTypes = {
children: CustomPropTypes.children,
classNameRoot: CustomPropTypes.className,
className: CustomPropTypes.className,
value: PropTypes.any.isRequired,
index: PropTypes.any.isRequired,
};