anvil/striker-ui/components/TabContent.tsx
2023-02-14 22:42:50 -05:00

22 lines
490 B
TypeScript

import { Box } from '@mui/material';
import { ReactElement, useMemo } from 'react';
const TabContent = <T,>({
changingTabId,
children,
tabId,
}: TabContentProps<T>): ReactElement => {
const isTabIdMatch = useMemo(
() => changingTabId === tabId,
[changingTabId, tabId],
);
const displayValue = useMemo(
() => (isTabIdMatch ? 'initial' : 'none'),
[isTabIdMatch],
);
return <Box sx={{ display: displayValue }}>{children}</Box>;
};
export default TabContent;