META-INF.resources.js.components.table.EmptyState.js Maven / Gradle / Ivy
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
import ClayEmptyState from '@clayui/empty-state';
import {sub} from 'frontend-js-web';
import React from 'react';
const DEFAULT_EMPTY = {
empty: {
className: 'taglib-empty-state',
title: Liferay.Language.get('there-are-no-entries'),
},
search: {
className: 'taglib-search-state',
title: Liferay.Language.get('no-results-were-found'),
},
};
const EmptyState = ({
button,
className = '',
description = null,
title = DEFAULT_EMPTY.empty.title,
}) => {
return (
{button && button()}
);
};
export function FilteredEmpty(props) {
const description = Liferay.Language.get(
'there-are-no-envelopes-with-these-attributes'
);
return ;
}
export function SearchEmpty({keywords, ...otherProps}) {
const description = sub(
Liferay.Language.get('there-are-no-envelopes-for-x'),
keywords
);
return ;
}
export function SearchAndFilteredEmpty({keywords, ...otherProps}) {
const description = sub(
Liferay.Language.get(
'there-are-no-envelopes-for-x-with-these-attributes'
),
keywords
);
return ;
}
export function withEmpty(Component) {
const Wrapper = ({
emptyState,
isEmpty,
isFiltered,
keywords,
...restProps
}) => {
if (isEmpty) {
if (keywords.length) {
if (isFiltered) {
return (
);
}
return (
);
}
if (isFiltered) {
return (
);
}
return ;
}
return ;
};
return Wrapper;
}
export default EmptyState;