From c735c908dc97c0168fed1cd436596d08e1fd7b5e Mon Sep 17 00:00:00 2001 From: Tomas Nygren Date: Tue, 4 May 2021 18:09:29 +1000 Subject: [PATCH] always show tab tools. only use isToolshown option to hide and show tab tools --- lib/ui/src/components/preview/preview.tsx | 3 +-- lib/ui/src/components/preview/toolbar.tsx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ui/src/components/preview/preview.tsx b/lib/ui/src/components/preview/preview.tsx index ed988509a25..b14ebd694a1 100644 --- a/lib/ui/src/components/preview/preview.tsx +++ b/lib/ui/src/components/preview/preview.tsx @@ -146,8 +146,7 @@ const Preview = React.memo((props) => { const tabs = useTabs(previewId, baseUrl, withLoader, getElements, story); const shouldScale = viewMode === 'story'; - const isToolshown = - !(viewMode === 'docs' && tabs.filter((t) => !t.hidden).length < 2) && options.isToolshown; + const { isToolshown } = options; const initialRender = useRef(true); useEffect(() => { diff --git a/lib/ui/src/components/preview/toolbar.tsx b/lib/ui/src/components/preview/toolbar.tsx index 66f5c748970..c510347f6b7 100644 --- a/lib/ui/src/components/preview/toolbar.tsx +++ b/lib/ui/src/components/preview/toolbar.tsx @@ -181,8 +181,7 @@ export function filterTools( path: State['path']; } ) { - const tabsTool = createTabsTool(tabs); - const toolsLeft = [tabs.filter((p) => !p.hidden).length > 1 ? tabsTool : null, ...tools]; + const toolsLeft = [tabs.filter((p) => !p.hidden).length >= 1 && createTabsTool(tabs), ...tools]; const toolsRight = [...toolsExtra]; const filter = (item: Partial) =>