import { capitalize } from '@mui/material/utils'; import Box from '@mui/material/Box'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import Container from '@mui/material/Container'; import Typography from '@mui/material/Typography'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import GradientText from 'docs/src/components/typography/GradientText'; import { Link } from '@mui/docs/Link'; import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; export default function Experiments({ experiments }) { const categories = {}; experiments.forEach((name) => { const paths = name.split('/'); const categoryName = paths.length === 1 ? 'Uncategorized' : capitalize(paths[0] || ''); if (!categories[categoryName]) { categories[categoryName] = []; } categories[categoryName].push({ name: name .replace(/^\//, '') .replace(/\/$/, '') .replace(`${categoryName.toLowerCase()}/`, ''), pathname: `/experiments/${name}`, }); }); return ( Welcome to MUI Experiments
    The files under /experiments/* are committed to git. These URLs (start with /experiments/*) are not accessible in production.
({ bgcolor: 'grey.50', flexGrow: 1, ...theme.applyStyles('dark', { bgcolor: 'primaryDark.900', }), })} > All Experiments ({experiments.length}) {experiments.length > 0 && ( {Object.entries(categories).map(([categoryName, children]) => ( {categoryName} {(children || []).map((aPage) => { return ( {aPage.name} ); })} ))} )}
); } export async function getStaticProps() { const experiments = []; const req = require.context('./', true, /^\.\/.*(? { experiments.push(k.replace(/^\.\/(.*)\.(js|tsx)$/, '$1')); }); return { props: { experiments, }, }; }