From 03dd7afc0ff31fd1e0736ed1a0f6668cc0c48868 Mon Sep 17 00:00:00 2001 From: Elena Martynova Date: Sun, 27 Oct 2024 15:34:49 +0300 Subject: [PATCH] fix(AdaptiveTabs): add ReactNode support for `hint` --- src/components/AdaptiveTabs/AdaptiveTabs.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/AdaptiveTabs/AdaptiveTabs.tsx b/src/components/AdaptiveTabs/AdaptiveTabs.tsx index a580ba3..d01dcbe 100644 --- a/src/components/AdaptiveTabs/AdaptiveTabs.tsx +++ b/src/components/AdaptiveTabs/AdaptiveTabs.tsx @@ -56,7 +56,7 @@ type OpenChangeProps = Parameters>[0]; export interface TabProps { id: string; title?: string | React.ReactNode; - hint?: string; + hint?: string | React.ReactNode; active?: boolean; disabled?: boolean; onClick?: (id: string, event: React.MouseEvent) => void; @@ -71,7 +71,7 @@ class Tab extends React.Component { // eslint-disable-next-line jsx-a11y/click-events-have-key-events
{title} @@ -769,14 +769,14 @@ export class AdaptiveTabs extends React.Component, Adapt const {items} = this.props; const activeTab = items.find((item) => item.id === this.activeTab); const tab = activeTab ?? items[0]; - const hint = tab.hint ?? ((typeof tab.title === 'string' && tab.title) || tab.id); + const hint = tab.hint ?? (tab.title || tab.id); return this.renderSwitcher({...switcherProps, text: hint, active: Boolean(activeTab)}); }; renderSwitcher = ( switcherProps: RenderControlProps & { - text: string; + text: string | React.ReactNode; active?: boolean; }, ) => {