Skip to content

Commit

Permalink
Bug iseec 3967 revert (#70)
Browse files Browse the repository at this point in the history
* Revert "fix: ssr for header"

This reverts commit 0b88bc9.

* chore: finish revert
  • Loading branch information
timrbula authored Jul 7, 2022
1 parent 0b88bc9 commit b71a0a5
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 234 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@boomerang-io/carbon-addons-boomerang-react",
"description": "Carbon Addons for Boomerang apps",
"version": "2.0.8",
"version": "2.0.9",
"author": {
"name": "Tim Bula",
"email": "timrbula@gmail.com"
Expand Down
18 changes: 7 additions & 11 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { settings } from 'carbon-components';
import FocusTrap from 'focus-trap-react';
import { SkipToContent } from 'carbon-components-react';
import window from 'window-or-global';
import PlatformNotificationsContainer from '../PlatformNotifications';
import HeaderMenu from '../HeaderMenu';
import NotificationsContainer from '../Notifications/NotificationsContainer';
Expand Down Expand Up @@ -308,16 +307,13 @@ class Header extends React.Component {
<nav aria-label="Main navigation menu">
<HeaderList className={`${prefix}--bmrg-header-list--link`}>
{Array.isArray(navLinks) &&
navLinks.map((link, i) => {
const isCurrentNavLink = window.location?.href?.startsWith(link.url);
return (
<li key={`${link.url}-${i}`}>
<HeaderListItem aria-label={`link for ${link.name}`} href={link.url} isCurrentNavLink={isCurrentNavLink}>
{link.name}
</HeaderListItem>
</li>
)
})}
navLinks.map((link, i) => (
<li key={`${link.url}-${i}`}>
<HeaderListItem aria-label={`link for ${link.name}`} href={link.url}>
{link.name}
</HeaderListItem>
</li>
))}
</HeaderList>
</nav>
<div ref={this.mobileNavRef}>
Expand Down
14 changes: 2 additions & 12 deletions src/components/Header/HeaderListItem.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import React from 'react';
import cx from 'classnames';
import { settings } from 'carbon-components';
import window from 'window-or-global';

const { prefix } = settings;

const HeaderListItem = (props) => {
const { children, className, href, isIcon, ariaExpanded, newNotifications, id, isCurrentNavLink, ...other } = props;
const { children, className, href, isIcon, ariaExpanded, newNotifications, id, ...other } = props;

const headerListItemClasses = cx(`${prefix}--bmrg-header-list__item`, className);

Expand All @@ -25,14 +24,6 @@ const HeaderListItem = (props) => {
>
{children}
</div>
) : isCurrentNavLink ? (
<Link
className={cx(`${prefix}--bmrg-header-list__link`, '--is-active')}
to="/"
tabIndex="0"
>
{children}
</Link>
) : (
<a
className={cx(`${prefix}--bmrg-header-list__link`, {
Expand All @@ -59,7 +50,6 @@ HeaderListItem.propTypes = {
className: PropTypes.string,
href: PropTypes.string,
id: PropTypes.string,
isCurrentNavLink: PropTypes.bool,
isIcon: PropTypes.bool,
newNotifications: PropTypes.bool,
};
Expand Down
Loading

0 comments on commit b71a0a5

Please sign in to comment.