Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Nav): Updated to add wrapper for nav link text #9740

Merged
merged 6 commits into from
Oct 23, 2023

Conversation

tlabaj
Copy link
Contributor

@tlabaj tlabaj commented Oct 11, 2023

What: Closes #9735

@patternfly-build
Copy link
Contributor

patternfly-build commented Oct 11, 2023

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates from before the latest commit looked good I believe. Currently the NavItem doesn't have the new nav__link-text class being rendered like it should compared to Core; that new class is only being rendered for the NavExpandable component.

The non-expandable NavItem in Core:

Core repo markup for NavItem component

The non-expandable NavItem in this PR:

React repo markup for NavItem component

@@ -68,6 +71,12 @@ A flyout should be a `Menu` component. Press `space` or `right arrow` to open a

```

### Link text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I feel like the example name could be tweaked a little, something like "With text and icon" or "Custom link text" or something. Not sure if "link text" fully conveys what the example is showing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know that the use case is specifically for an icon. You can pass any react node.

id={srText ? null : this.id}
onClick={(event) => this.onExpand(event, context.onToggle)}
aria-expanded={expandedState}
tabIndex={isSidebarOpen ? null : -1}
{...buttonProps}
>
{title}
{typeof title !== 'string' ? <span className={css(`${styles.nav}__link-text`)}>{title}</span> : title}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, only other thing is that we're having this wrapper be an opt-in for the NavItem, but providing logic here to determine if the wrapper is used or not. It seems like we'd want it to be opt in in both places?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it is not opt in here because we did not have the ability to pass a react node before. Menaing. that it is a new feature. We will not be breaking anyone.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we open an issue to make this the default in the next breaking change, if there isn't one already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcoker breaking change issue opened #9755

@@ -188,7 +191,7 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
{...(hasFlyout && { ...ariaFlyoutProps })}
{...props}
>
{children}
{hasNavLinkWrapper ? <span className={css(`${styles.nav}__link-text`)}>{children}</span> : children}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I have questions about the example, but I think the feature is good-to-go 🚀

@@ -7,6 +7,9 @@ ouia: true
---

import './nav.css';
import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
import UserIcon from '@patternfly/react-icons/dist/esm/icons/user-icon';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import UserIcon from '@patternfly/react-icons/dist/esm/icons/user-icon';
import UserIcon from '@patternfly/react-icons/dist/esm/icons/user-icon';

<NavExpandable
title={
<>
Link 2<small>(small text)</small>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a space

Suggested change
Link 2<small>(small text)</small>
Link 2 <small>(small text)</small>

<NavExpandable
title={
<>
Link 3<strong>(strong text)</strong>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Link 3<strong>(strong text)</strong>
Link 3 <strong>(strong text)</strong>

Comment on lines +58 to +59
<UserIcon />
Subnav link 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to add hasNavLinkWrapper to this and the one below? With adding the space to the 2 items I left comments about, and adding hasNavLinkWrapper here and the next item, it would look like this:

Screenshot 2023-10-17 at 1 59 55 PM

Here's what it looks like now:

Screenshot 2023-10-17 at 2 00 15 PM

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@kmcfaul kmcfaul merged commit 32655ae into patternfly:main Oct 23, 2023
10 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-code-editor@5.2.0-prerelease.14
  • @patternfly/react-core@5.2.0-prerelease.14
  • @patternfly/react-docs@6.2.0-prerelease.14
  • demo-app-ts@5.1.1-prerelease.37
  • @patternfly/react-table@5.2.0-prerelease.14

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(NavExpandable): allow title prop to accept ReactNodes
6 participants