Spaces:
Configuration error
Configuration error
Download src/components/common/LoadingPanel.tsx from SreejithSHR/umami: direct link, hf CLI and curl.
- Browser
- Download file 973 Bytes
-
https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/common/LoadingPanel.tsx
- Command line
-
hf download hf://spaces/SreejithSHR/umami/src/components/common/LoadingPanel.tsx
-
curl -L -o LoadingPanel.tsx https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/common/LoadingPanel.tsx
973 Bytes
| import { ReactNode } from 'react'; | |
| import classNames from 'classnames'; | |
| import { Loading } from 'react-basics'; | |
| import ErrorMessage from 'components/common/ErrorMessage'; | |
| import Empty from 'components/common/Empty'; | |
| import styles from './LoadingPanel.module.css'; | |
| export function LoadingPanel({ | |
| data, | |
| error, | |
| isFetched, | |
| isLoading, | |
| loadingIcon = 'dots', | |
| className, | |
| children, | |
| }: { | |
| data?: any; | |
| error?: Error; | |
| isFetched?: boolean; | |
| isLoading?: boolean; | |
| loadingIcon?: 'dots' | 'spinner'; | |
| isEmpty?: boolean; | |
| className?: string; | |
| children: ReactNode; | |
| }) { | |
| const isEmpty = !isLoading && isFetched && data && Array.isArray(data) && data.length === 0; | |
| return ( | |
| <div className={classNames(styles.panel, className)}> | |
| {isLoading && !isFetched && <Loading className={styles.loading} icon={loadingIcon} />} | |
| {error && <ErrorMessage />} | |
| {!error && isEmpty && <Empty />} | |
| {!error && !isEmpty && data && children} | |
| </div> | |
| ); | |
| } | |