FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Dropdown: allow custom dropdown items by jschuler · Pull Request #2890 · patternfly/patternfly-react · GitHub

Dropdown: allow custom dropdown items - #2890

Merged
tlabaj merged 3 commits into
patternfly:masterfrom
jschuler:dropdown-custom-items
Sep 10, 2019
Merged

Dropdown: allow custom dropdown items#2890
tlabaj merged 3 commits into
patternfly:masterfrom
jschuler:dropdown-custom-items

Conversation

jschuler commented Sep 9, 2019

Copy link
Copy Markdown
Contributor

Closes: #2675

Keyboard navigation triggers on the <li> items now so that any custom node passed into <DropdownItem> can work without trowing errors.

Example:

Code:

render() {
  const { isOpen } = this.state;
  const dropdownItems = [
    <DropdownItem key="action">
      Default
    </DropdownItem>,
    <DropdownItem>
      <FormattedMessage
        id="welcome"
        defaultMessage={`Hello {name}, you have {unreadCount, number} {unreadCount, plural,
                    one {message}
                    other {messages}
                  }`}
        values={{name: <b>Joachim</b>, unreadCount: 25}}
      />
    </DropdownItem>,
    <DropdownItem key="action" component="button">
      Render as button
    </DropdownItem>,
    <DropdownItem key="link"><Button>Use Button component</Button></DropdownItem>,
    <DropdownItem key="disabled link">
      <Alert title="Use Alert component" />
    </DropdownItem>,
    <DropdownItem key="disabled action" isDisabled component="button">
      Disabled Action
    </DropdownItem>,
    <DropdownSeparator key="separator" />,
    <DropdownItem key="separated link">Separated Link</DropdownItem>,
    <DropdownItem key="separated action" component="button">
      Separated Action
    </DropdownItem>
  ];
  return (
    <IntlProvider locale="en">
      <Dropdown
        onSelect={this.onSelect}
        toggle={<DropdownToggle onToggle={this.onToggle} iconComponent={CaretDownIcon}>Dropdown</DropdownToggle>}
        isOpen={isOpen}
        dropdownItems={dropdownItems}
      />
    </IntlProvider>
  );
}

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-2890.surge.sh

tlabaj requested a review from jessiehuff September 9, 2019 18:56
isDisabled: boolean;
disabled: boolean;
isHovered: boolean;
ref: React.RefObject<any>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Changing this type here wont break anyone?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The refs are used internally so I don't think it should

kmcfaul commented Sep 9, 2019

Copy link
Copy Markdown
Contributor

Waiting on the commit to set the autofocus based on keyboard entry opposed to all the time, but everything else is looking good!

dlabaj previously approved these changes Sep 9, 2019
tlabaj requested a review from mcarrano September 9, 2019 20:08
jessiehuff previously approved these changes Sep 9, 2019

jessiehuff left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM - from an accessibility standpoint, keyboard functionality and voiceover work as expected after Jenn and I tested it. :)

mcarrano previously approved these changes Sep 9, 2019

mcarrano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This looks fine as far as I can tell.

mcarrano removed the ux review label Sep 9, 2019
karelhala previously approved these changes Sep 10, 2019

karelhala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice! this is really good adition and will help us a lot!

jschuler dismissed stale reviews from karelhala, mcarrano, jessiehuff, and dlabaj via 8a9c177 September 10, 2019 14:29

kmcfaul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks great!

karelhala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Still looking awesome!

tlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

tlabaj merged commit 9335f73 into patternfly:master Sep 10, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

DropdownItem HTML elements

8 participants


Back | FazBrowse Home | New Git URL