META-INF.resources.js.components.digital-signature-form.FileEntryList.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.digital.signature.web
Show all versions of com.liferay.digital.signature.web
Liferay Digital Signature Web
The newest version!
/**
* 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 {ClayButtonWithIcon} from '@clayui/button';
import ClayList from '@clayui/list';
import classNames from 'classnames';
import React from 'react';
const FileEntryList = ({errors, fileEntries = [], setFieldValue}) => {
const hasError = (fileEntryId) => {
if (errors) {
return !!errors.find((entry) => entry.fileEntryId === fileEntryId);
}
return false;
};
const onRemoveFileEntry = (fileEntryIndex) => {
setFieldValue(
'fileEntries',
fileEntries.filter((_, index) => index !== fileEntryIndex)
);
};
if (!fileEntries.length) {
return null;
}
return (
{Liferay.Language.get('documents-added')}
{fileEntries.map(({fileEntryId, title}, index) => (
{title}
{hasError(fileEntryId) && (
{Liferay.Language.get(
'this-file-extension-is-not-supported-by-docusign'
)}
)}
onRemoveFileEntry(index)}
symbol="trash"
/>
))}
);
};
export default FileEntryList;