Skip to content

Commit

Permalink
Add example of non-closable
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrunyon committed Dec 21, 2023
1 parent de05759 commit d56bc4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/code-studio/src/styleguide/Navigations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/navigation/NavTabList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d56bc4e

Please sign in to comment.