diff --git a/packages/react/.loki/reference/chrome_iphone7_Components_Header_With_Custom_Menu.png b/packages/react/.loki/reference/chrome_iphone7_Components_Header_With_Custom_Menu.png new file mode 100644 index 0000000000..04885bfd23 Binary files /dev/null and b/packages/react/.loki/reference/chrome_iphone7_Components_Header_With_Custom_Menu.png differ diff --git a/packages/react/.loki/reference/chrome_laptop_Components_Header_With_Custom_Menu.png b/packages/react/.loki/reference/chrome_laptop_Components_Header_With_Custom_Menu.png new file mode 100644 index 0000000000..eb18876813 Binary files /dev/null and b/packages/react/.loki/reference/chrome_laptop_Components_Header_With_Custom_Menu.png differ diff --git a/packages/react/src/components/header/Header.stories.tsx b/packages/react/src/components/header/Header.stories.tsx index 48fad28b57..83bcc20b09 100644 --- a/packages/react/src/components/header/Header.stories.tsx +++ b/packages/react/src/components/header/Header.stories.tsx @@ -761,3 +761,38 @@ export const WithUserMenu = (args: HeaderProps) => { ); }; + +export const WithCustomMenu = (args: HeaderProps) => { + const lang = 'fi'; + const I18n = translations[lang]; + const versions = ['Version 4.0.0', 'Version 3.11.0', 'Version 2.17.1']; + const selectedVersion = 'Version 3.11.0'; + + return ( + <> +
+ + + } + logoAriaLabel={I18n.ariaLogo} + > + + {versions.map((version) => ( + + ))} + + +
+
+ + ); +}; diff --git a/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.module.scss b/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.module.scss index 7c741ffaac..5c2c5d77e2 100644 --- a/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.module.scss +++ b/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.module.scss @@ -152,6 +152,10 @@ & > h4 { padding: 0 !important; } + + &.selected { + border-left: 4px solid var(--color-black); + } } & .dropdownItem button { diff --git a/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.tsx b/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.tsx index 84b526d12d..4ff9091275 100644 --- a/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.tsx +++ b/packages/react/src/components/header/components/headerActionBarItem/HeaderActionBarItem.tsx @@ -141,6 +141,7 @@ export const HeaderActionBarItem = (properties: HeaderActionBarItemProps) => { activeStateLabel: closeLabel, } : {}; + const heading = visible && !fullWidth && label && avatar; /* eslint-disable jsx-a11y/no-noninteractive-tabindex */ return ( @@ -165,7 +166,7 @@ export const HeaderActionBarItem = (properties: HeaderActionBarItemProps) => { {hasSubItems && (
- {visible && !fullWidth && label &&

{label}

} + {heading &&

{label}

}
    {children}
diff --git a/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.module.scss b/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.module.scss index bf0d8e125c..caff5b4b32 100644 --- a/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.module.scss +++ b/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.module.scss @@ -24,6 +24,10 @@ h4.actionBarSubItem { font-weight: bold; } + &.selected { + text-decoration: underline; + } + &:focus-visible { border: none; outline: 0; diff --git a/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.tsx b/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.tsx index 8ac0c8ee1d..af5f2be082 100644 --- a/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.tsx +++ b/packages/react/src/components/header/components/headerActionBarSubItem/HeaderActionBarSubItem.tsx @@ -47,6 +47,10 @@ export interface HeaderActionBarSubItemProps extends ElementProps { * If bold */ bold?: boolean; + /** + * If selected + */ + selected?: boolean; /** * Hypertext Reference of the link. */ @@ -75,6 +79,7 @@ export const HeaderActionBarSubItem = forwardRef { @@ -151,7 +157,14 @@ export const HeaderActionBarSubItem = forwardRef{children} ) : ( -
  • {children}
  • +
  • + {children} +
  • ); }, [isHeading, itemClassName], diff --git a/site/src/components/layout.js b/site/src/components/layout.js index c2949b64ca..5268f3ff55 100644 --- a/site/src/components/layout.js +++ b/site/src/components/layout.js @@ -147,7 +147,8 @@ const Layout = ({ location, children, pageContext }) => { const pathParts = pathName.split('/'); const version = pathParts[1].startsWith('release-') ? pathParts[1] : undefined; const locationWithoutVersion = hrefWithoutVersion(pathName, version); - const versionLabel = version ? `Version ${version.replace('release-', '')}` : `Version ${versions[0]}`; + const versionNumber = version ? version.replace('release-', '') : versions[0]; + const versionLabel = `Version ${versionNumber}`; // Some hrefs of internal links can't be replaced with MDXProvider's replace component logic. // this code will take care of those @@ -272,11 +273,12 @@ const Layout = ({ location, children, pageContext }) => { logo={} > - {versions.map((versionNumber, index) => ( + {versions.map((itemVersion, index) => ( 0 - ? hrefWithVersion(locationWithoutVersion, `release-${versionNumber}`) + ? hrefWithVersion(locationWithoutVersion, `release-${itemVersion}`) : withPrefix(locationWithoutVersion)} /> ))}