UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

77 lines (75 loc) 2.76 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import * as React from 'react'; import Skeleton from '@mui/material/Skeleton'; import { makeStyles } from 'tss-react/mui'; import PathNavigatorTreeSkeletonItem from './PathNavigatorTreeSkeletonItem'; const useStyles = makeStyles()(() => ({ skeletonRoot: { margin: '10px 0' }, skeletonHeader: { display: 'flex', marginBottom: '5px', padding: '0 10px' }, skeletonBody: { paddingLeft: '5px' }, skeletonBodyItem: { display: 'flex', padding: '5px 5px' } })); function PathNavigatorSkeletonTree({ numOfItems = 5 }) { const { classes } = useStyles(); return React.createElement( 'section', { className: classes.skeletonRoot }, React.createElement( 'header', { className: classes.skeletonHeader }, React.createElement(Skeleton, { variant: 'rectangular', width: '20px' }), React.createElement(Skeleton, { variant: 'text', style: { margin: '0 10px', width: '100%' } }), React.createElement(Skeleton, { variant: 'circular', width: '20px' }) ), React.createElement( 'section', { className: classes.skeletonBody }, new Array(numOfItems) .fill(null) .map((_, index) => React.createElement(PathNavigatorTreeSkeletonItem, { classes: { root: classes.skeletonBodyItem }, key: index }) ) ) ); } export default PathNavigatorSkeletonTree;