From 40cf27e18fc1060cb6ce97fe6cd8a9c073a9aded Mon Sep 17 00:00:00 2001 From: Sofiya Pavlenko Date: Thu, 7 Nov 2024 16:38:46 +0300 Subject: [PATCH] fix(Toc): correctly display content of no items.length and add event forward --- src/components/Toc/Toc.tsx | 7 +++++-- src/components/Toc/TocItem/TocItem.tsx | 23 ++++++++++++++--------- src/components/Toc/__tests__/Toc.test.tsx | 22 ++++++++++++++++------ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/components/Toc/Toc.tsx b/src/components/Toc/Toc.tsx index a29575dbe1..30e9b65dab 100644 --- a/src/components/Toc/Toc.tsx +++ b/src/components/Toc/Toc.tsx @@ -15,10 +15,11 @@ export interface TocProps extends QAProps { items: TocItemType[]; value?: string; onUpdate?: (value: string) => void; + onItemClick?: (event: React.MouseEvent) => void; } export const Toc = React.forwardRef(function Toc(props, ref) { - const {value: activeValue, items, className, onUpdate, qa} = props; + const {value: activeValue, items, className, onUpdate, onItemClick, qa} = props; return (