From f618ab5f8ab2d4585917873c0b4ca90b456501e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daria=20Domaga=C5=82a?= <40663133+dariadomagala@users.noreply.github.com> Date: Thu, 3 Nov 2022 08:32:58 +0100 Subject: [PATCH] feat: add compact option to product menu, remove console errors (#1446) * feat: add compact option to product menu, remove console errors * feat: add glyph to the settings menu --- .storybook/custom/components/DocsPage.js | 2 +- src/Shellbar/Shellbar.js | 58 ++++++++++++++++++-- src/Shellbar/__stories__/Shellbar.stories.js | 1 + src/SideNavigation/_SideNavListItem.js | 6 +- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/.storybook/custom/components/DocsPage.js b/.storybook/custom/components/DocsPage.js index b8d55434a..d1760f67b 100644 --- a/.storybook/custom/components/DocsPage.js +++ b/.storybook/custom/components/DocsPage.js @@ -80,7 +80,7 @@ const DocsPage = () => { Examples - {stories.map((story) => story && story && } + {productSwitch && productSwitch.compact && ( + + + {productSwitchList.map((item, index) => { + return ( + + {item.glyph && ( + <> + +     + + )} + {item.title} + + ); + })} + + + ) + } + control={ + + } + noArrow + popperProps={{ id: `${cssNamespace}-shellbar-product-popover` }} /> + )} {profile && (
@@ -441,7 +487,7 @@ class Shellbar extends Component { className={classnames(`${cssNamespace}-shellbar__avatar--circle`)} color={profile.colorAccent} size='xs'> - {profile.initials} + {profile.glyph ? : profile.initials} )} @@ -451,7 +497,7 @@ class Shellbar extends Component {
)} - {productSwitch && ( + {productSwitch && !productSwitch.compact && (
( }} productMenu={productMenu} productSwitch={{ + compact: false, label: 'Product Switch' }} productSwitchList={[ diff --git a/src/SideNavigation/_SideNavListItem.js b/src/SideNavigation/_SideNavListItem.js index e32f70f3d..3fd9dd909 100644 --- a/src/SideNavigation/_SideNavListItem.js +++ b/src/SideNavigation/_SideNavListItem.js @@ -60,7 +60,7 @@ class SideNavListItem extends React.Component { href={url} onClick={!hasChild ? (e) => { !hasChild && onClick(e); - onItemSelect(e, id, hasChild); + if (onItemSelect) onItemSelect(e, id, hasChild); } : null}> {glyph ? ( { /* eslint-disable jsx-a11y/no-noninteractive-tabindex */ onClick(e); - onItemSelect(e, id, hasChild); + if (onItemSelect) onItemSelect(e, id, hasChild); }}> {link}