Skip to content

Commit

Permalink
made the Discussion clickable and navigate to discussionAll
Browse files Browse the repository at this point in the history
  • Loading branch information
KaleemNeslit committed Oct 10, 2024
1 parent 2fa11c6 commit a285377
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ type BreadcrumbsProps = {
tooltipStr?: string;
};

const handleNavigation = (label, navigate, isParent) => {
if (label === 'Discussions' && isParent) {
navigate(`/discussions`);
}
};
const handleMouseInteraction = (
label: string,
handleInteraction: (event: React.MouseEvent<HTMLSpanElement>) => void,
event: React.MouseEvent<HTMLSpanElement>,
) => {
if (label !== 'Discussions') {
handleInteraction(event);
}
};

export const CWBreadcrumbs = ({
breadcrumbs,
tooltipStr,
Expand All @@ -36,14 +51,19 @@ export const CWBreadcrumbs = ({
placement="bottom"
renderTrigger={(handleInteraction) => (
<CWText
onMouseEnter={handleInteraction}
onMouseLeave={handleInteraction}
onMouseEnter={(event) =>
handleMouseInteraction(label, handleInteraction, event)
}
onMouseLeave={(event) =>
handleMouseInteraction(label, handleInteraction, event)
}
type="caption"
className={clsx({
'disable-active-cursor': index === 0,
'current-text': isCurrent,
'parent-text': !isCurrent,
})}
onClick={() => handleNavigation(label, navigate, isParent)}
>
{truncateText(label)}
</CWText>
Expand Down

0 comments on commit a285377

Please sign in to comment.