import useMessages, { Messages } from '@i18n/hooks/messagesHook'; import classNames from '@lib/class-names/ClassNames'; import { ListProps } from '@lib/plume-admin-theme/list/ListProps'; import ListLoader from './ListLoader'; import scss from './list.module.scss'; type ListEmptyStateProps = { label: string, }; function EmptyState({ label }: Readonly) { return (
{label}
); } /** * This component handles the display of a loading list * - A loader is displayed when the elements are loading * - An empty state is displayed when no elements were found * - Otherwise, the elements are displayed through the {@param children} */ function List({ isEmpty, isLoading = false, showLoader = true, emptyStateLabel, className, children, }: Readonly) { const { messages }: Messages = useMessages(); if (isLoading && showLoader) { return (
); } if (!isLoading && isEmpty) { return (
); } return (
{children}
); } export default List;