From d56bc4eccedcbc55dc38d54d72c28759702be20c Mon Sep 17 00:00:00 2001 From: Matthew Runyon Date: Thu, 21 Dec 2023 12:37:26 -0600 Subject: [PATCH] Add example of non-closable --- packages/code-studio/src/styleguide/Navigations.tsx | 2 +- packages/components/src/navigation/NavTabList.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/code-studio/src/styleguide/Navigations.tsx b/packages/code-studio/src/styleguide/Navigations.tsx index e54b028c42..2b5ea61c7a 100644 --- a/packages/code-studio/src/styleguide/Navigations.tsx +++ b/packages/code-studio/src/styleguide/Navigations.tsx @@ -22,7 +22,7 @@ function NavTabListExample({ const [tabs, setTabs] = useState(() => { const tabItems: NavTabItem[] = []; for (let i = 0; i < count; i += 1) { - tabItems.push({ key: `${i}`, title: `Tab ${i}`, isClosable: true }); + tabItems.push({ key: `${i}`, title: `Tab ${i}`, isClosable: i > 0 }); } return tabItems; }); diff --git a/packages/components/src/navigation/NavTabList.tsx b/packages/components/src/navigation/NavTabList.tsx index dd6359cec8..e6dccf01f1 100644 --- a/packages/components/src/navigation/NavTabList.tsx +++ b/packages/components/src/navigation/NavTabList.tsx @@ -69,9 +69,9 @@ function makeBaseContextItems( tabs: NavTabItem[], onClose: ((key: string) => void) | undefined ): ResolvableContextAction[] { - const { isClosable, key } = tab; + const { isClosable = false, key } = tab; const contextActions: ResolvableContextAction[] = []; - if (isClosable != null && onClose != null) { + if (isClosable && onClose != null) { contextActions.push({ title: 'Close', order: 10,