Skip to content

Commit

Permalink
Merge pull request #171 from ConductionNL/feature/GW-1542/topnav
Browse files Browse the repository at this point in the history
feature/GW-1542/topnav
  • Loading branch information
remko48 authored Dec 5, 2023
2 parents e61ee50 + 6dac33b commit d8cbc00
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- **Version 2.2 (breaking changes from 2.1.x)**

- 2.2.40: Removed tooltip from PrimaryTopNav component and updated dropdown.
- 2.2.39:
- Updated PrimaryTopNav component to include tooltip and better dropdown.
- Updated Logo component to have navbar option.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@conduction/components",
"version": "2.2.39",
"version": "2.2.40",
"description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
"main": "lib/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/components/topNav/primaryTopNav/PrimaryTopNav.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@
display: none;
list-style-type: none;
background-color: var(--conduction-primary-top-nav-dropdown-background-color, var(--conduction-primary-top-nav-background-color));
width: fit-content;
max-width: 200px;
}

.dropdownOverflow {
Expand Down
12 changes: 3 additions & 9 deletions src/components/topNav/primaryTopNav/PrimaryTopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { IconPrefix, IconName } from "@fortawesome/fontawesome-svg-core";
interface ITopNavItemBase {
label: string;
icon?: JSX.Element;
showToolTip?: boolean;
current?: boolean | ICurrentItemJSONFormat;
}

Expand Down Expand Up @@ -58,12 +57,11 @@ export type ITopNavItem = ITopNavItemWithSubItems | ITopNavItemWithoutSubItems;

export interface TopNavProps {
items: ITopNavItem[];
tooltipId: string;
mobileLogo?: JSX.Element;
layoutClassName?: string;
}

export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName, tooltipId }: TopNavProps): JSX.Element => {
export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProps): JSX.Element => {
const [isOpen, setIsOpen] = React.useState<boolean>(false);
const [isMobile, setIsMobile] = React.useState<boolean>(window.innerWidth < 992);

Expand Down Expand Up @@ -112,17 +110,13 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName, tooltipId }:

{subItems && (
<ul className={clsx(styles.dropdown, [subItems.length > 8 && styles.dropdownOverflow])}>
{subItems.map(({ label, icon, current, handleClick, showToolTip }, idx) => (
{subItems.map(({ label, icon, current, handleClick }, idx) => (
<li
key={idx}
className={clsx(styles.li, current && styles.current)}
onClick={() => handleSubItemClick(handleClick)}
>
<Link
data-tooltip-id={showToolTip === true ? tooltipId : ""}
data-tooltip-content={showToolTip === true ? label : ""}
className={clsx(styles.link, styles.label, current && styles.currentLink)}
>
<Link className={clsx(styles.link, styles.label, current && styles.currentLink)}>
{icon}
{label}
</Link>
Expand Down

0 comments on commit d8cbc00

Please sign in to comment.