META-INF.resources.js.components.BreadcrumbNode.es.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 ClayDropDown from '@clayui/drop-down';
import ClayIcon from '@clayui/icon';
import classNames from 'classnames';
import React, {useContext} from 'react';
import {AppContext} from '../AppContext.es';
import Link from './Link.es';
const getSectionURL = (context, section) => {
if (section.href) {
return section.href;
}
return context.useTopicNamesInURL ? section.friendlyUrlPath : section.id;
};
export default function BreadcrumbNode({
hasDropdown = false,
isEllipsis = false,
isFirstNode = false,
section = {},
ui,
}) {
const context = useContext(AppContext);
return (
{hasDropdown &&
section.subSections &&
!!section.subSections.length ? (
{isEllipsis ? (
) : (
{ui || section.title}
)}
}
>
{section.subSections.map((subSection, index) => (
{subSection.title}
))}
) : context.showCardsForTopicNavigation && isFirstNode ? (
{ui || section.title}
) : (
{ui || section.title}
)}
);
}