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(ApplicationLauncher): Add Application Launcher Component #319

Merged
merged 1 commit into from
Jun 14, 2018

Conversation

glekner
Copy link
Contributor

@glekner glekner commented Apr 26, 2018

fix #184

What:
Add an Application Launcher Component.

Managed to show all the launcher types in one storybook: Grid/List Icons/No Icons with the help of the knobs

Link to Storybook:
Storybook

Additional issues:

  • Figuring out the Icons names are a real pain, any easy way to do it?
    e.g. - applauncher-pf-link-icon pficon pficon-domain - What is the name prop that i need to give to <Icon /> in order to render this icon?

TODO:

  • Create Tests

@glekner glekner changed the title WIP feat(ApplicationLauncher): Add Application Launcher Component WIP: feat(ApplicationLauncher): Add Application Launcher Component Apr 26, 2018
>
<li className={classes} role="menuitem">
<a className="applauncher-pf-link" href="#" onClick={e => onClick(e)}>
<i className={icon} aria-hidden="true" />
Copy link
Contributor

Choose a reason for hiding this comment

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

<Icon name="home" className="applauncher-pf-link-icon" />

@glekner glekner force-pushed the feature-applauncher branch from e0a2f88 to e2f217f Compare April 29, 2018 08:20
@coveralls
Copy link

coveralls commented Apr 29, 2018

Pull Request Test Coverage Report for Build 1441

  • 30 of 38 (78.95%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 74.679%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/core/src/components/ApplicationLauncher/ApplicationLauncher.js 5 6 83.33%
packages/core/src/components/ApplicationLauncher/Wrappers/ApplicationLauncherWrapper.js 6 7 85.71%
packages/core/src/components/ApplicationLauncher/ApplicationLauncherToggle.js 5 6 83.33%
packages/core/src/components/ApplicationLauncher/ApplicationLauncherItem.js 7 9 77.78%
packages/core/src/components/ApplicationLauncher/Wrappers/StatefulApplicationLauncherWrapper.js 5 8 62.5%
Totals Coverage Status
Change from base Build 1416: 0.04%
Covered Lines: 1747
Relevant Lines: 2141

💛 - Coveralls

@glekner glekner force-pushed the feature-applauncher branch from e2f217f to a6e73df Compare April 29, 2018 08:29
@glekner glekner changed the title WIP: feat(ApplicationLauncher): Add Application Launcher Component feat(ApplicationLauncher): Add Application Launcher Component Apr 29, 2018
@glekner
Copy link
Contributor Author

glekner commented Apr 29, 2018

  • Added Tests, Fixed Icons
  • Added a Wrapper component and story

@glekner glekner force-pushed the feature-applauncher branch 2 times, most recently from e11ae7b to cea99b6 Compare April 29, 2018 09:21
import { Button } from '../Button';

const ApplicationLauncherToggle = ({ onClick, tooltipPlacement }) => {
const tooltip = <Tooltip id="tooltip">Application Launcher</Tooltip>;
Copy link
Member

Choose a reason for hiding this comment

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

Application Launcher should be replaced with a passed in prop.


this.state = {
showLauncher: false,
type: props.type
Copy link
Member

Choose a reason for hiding this comment

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

why add type to state rather than simply using the prop? It should only be mutable by the caller

{
'applauncher-pf dropdown dropdown-kebab-pf': this.state.type === 'list'
},
{ open: this.state.showLauncher }
Copy link
Member

Choose a reason for hiding this comment

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

Would be better to always specify applauncher-pf dropdown dropdown-kebab-pf and add applauncher-pf-block-list if type === grid.

/** Icon Type */
icon: PropTypes.string.isRequired,
/** App Tooltip */
tooltip: PropTypes.string.isRequired,
Copy link
Member

Choose a reason for hiding this comment

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

Should this be required? I'm not sure all items will need a tooltip.

};
ApplicationLauncherWrapper.propTypes = {
/** Array of App Objects */
apps: PropTypes.array.isRequired,
Copy link
Member

Choose a reason for hiding this comment

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

Could we define a shape for this so callers no what fields are required?

@glekner glekner force-pushed the feature-applauncher branch 2 times, most recently from 3059dbe to e876cac Compare May 12, 2018 18:50
@glekner
Copy link
Contributor Author

glekner commented May 12, 2018

@glekner glekner force-pushed the feature-applauncher branch from e876cac to 76189cf Compare May 13, 2018 08:12
/** Children Node */
children: PropTypes.node.isRequired,
/** tooltipPlacement */
tooltipPlacement: PropTypes.string,
Copy link
Member

Choose a reason for hiding this comment

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

Need to take a tooltip as well otherwise it will always be Application Launcher

/** Grid instead of List (List is Default) */
grid: PropTypes.bool,
/** Tooltip Placement */
tooltipPlacement: PropTypes.string
Copy link
Member

Choose a reason for hiding this comment

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

Should take a tooltip to pass to the ApplicationLauncher to pass to the ApplicationLauncherToggle

@glekner glekner force-pushed the feature-applauncher branch 2 times, most recently from 0c11d60 to 2196974 Compare May 15, 2018 07:34
@glekner
Copy link
Contributor Author

glekner commented May 15, 2018

  • Fixed Toggle tooltip and added a Shape proptype for the apps array inside the wrapper.

@jgiardino
Copy link
Collaborator

@patternfly/patternfly-react-ux
Can someone can do a UX review of this component?

@lizsurette
Copy link
Contributor

@jgiardino I'll review this afternoon.

@lizsurette
Copy link
Contributor

@gilad215 Thanks for this addition! A few comments based on a UX review:

  1. Is there a plan to support both the Horizontal Nav (short masthead) as well? If not at the moment, maybe it would be worth documenting that this is just for use with the tall masthead?
  2. I'm not sure we need the tooltips. These are specified in the base PF implementation.
  3. Clicking outside of the popup should dismiss the popup as it does in the base PF implementation.
  4. There should not be an arrow pointing to the icon when opened. It should just be a straight edge as a typical dropdown would have.

@jgiardino @Rohoover @terezanovotna anything else you guys want to add?

Thanks,
Liz

@glekner
Copy link
Contributor Author

glekner commented May 23, 2018

  • Added a Stateful Wrapper to handle the Open/Close and added a ClickedOutSide functionality
  • Toggle Tooltip is now optional

Thanks for the review @lizsurette

  1. Since the size of the dropdowns are the same on the different nav bars, I believe the app launcher is supported on both. I see the same classnames of the toggle component for the short and tall masthead.
  2. Tooltips are in the design section, If youre talking about the toggle tooltip, its now optional.

screen shot 2018-05-23 at 12 18 06

  1. I added a Stateful wrapper and added a ClickedOutSide functionality to it, but its the responsibility of the consumer to handle these kinds of actions.

  2. Removed the Arrow.

@jeff-phillips-18
Copy link
Member

@lizsurette Can you open an issue against the design documentation to remove the arrow pointing to the icon when opened from the images included there?

@jeff-phillips-18
Copy link
Member

@lizsurette Looks like what is here is correct then. Are you OK with this now?

@lizsurette
Copy link
Contributor

@mcarrano Thanks for confirming the correct design, Matt!

@gilad215 @jeff-phillips-18 Yep, this is good to go now from a UX point of view :)

@jeff-phillips-18 I logged the issue in angular-patternfly: patternfly/angular-patternfly#741

@jgiardino
Copy link
Collaborator

jgiardino commented May 25, 2018

Great work on this, @gilad215! I have a few questions about it, and then some requests listed below…

  1. What’s the difference between the two storybooks? Nevermind. I see you described this in your previous comment.
  2. In the pf core example, at 768px, the elements in the masthead are hidden and become available in the vertical navigation menu. Do you know if that behavior is possible with this component? Or should we add a separate issue to capture that?

Requested updates:

  1. Please provide this link in the storybook for the design documentation:
    http://www.patternfly.org/pattern-library/application-framework/launcher/#design

  2. The element .applauncher-pf-block-list is missing the class .dropdown, and the <button> is missing .dropdown-toggle. These classes are used in a few different selectors that apply padding to the button.

  3. The button element should include an aria-expanded attribute, set to “true” when the menu is visible and “false” when the menu is hidden.

  4. Inside the button, the current pf core implementation includes several span elements that are missing. These are all the contents of the button in the pf core example:

    <span class="fa fa-th applauncher-pf-icon" aria-hidden="true"></span>
    <span class="dropdown-title">
      <span class="applauncher-pf-title">
        Application Launcher
        <span class="caret" aria-hidden="true"></span>
      </span>
    </span>
    

    In this implementation, there's only this one span:

    <span aria-describedby="tooltip" aria-hidden="true" class="fa fa- fa fa-th applauncher-pf-icon"></span>
    
    • Please update the class names so that they match what’s included for core
    • Please move the aria-describedby attribute to the parent <a>. This attribute has better support for interactive elements, like <a>.
  5. The roles currently applied to the menu in the pf core example are actually incorrect. The way they’re applied for the pf-react dropdown button are correct.

  6. When I hover over menu items, the <li> gets the attribute aria-describedby=“tooltip”, but it should be applied to the <a> instead. The value should also map to the id value of another element, but currently all menu items are referencing the same tooltip id. Could you update the example to show different tooltip text being used? It would be good to verify that this works as expected, but also good to provide an example that's closer to what consumers would be implementing.

@jgiardino
Copy link
Collaborator

I opened an issue about the incorrect roles (item # 5 in my previous comment): patternfly/patternfly#1063

@glekner glekner force-pushed the feature-applauncher branch 2 times, most recently from d80e8eb to cbc761c Compare May 27, 2018 09:31
@glekner
Copy link
Contributor Author

glekner commented May 27, 2018

@jgiardino

In the pf core example, at 768px, the elements in the masthead are hidden and become available in the vertical navigation menu. Do you know if that behavior is possible with this component? Or should we add a separate issue to capture that?

Should be possible, in your example the launcher should not be rendered at a certain width, its the responsibility of the consumer to handle these kind of behaviours.

  1. Fixed doc link
  2. Added .dropdown-toggle for the button, This div already has the .dropdown class for me:

screen shot 2018-05-27 at 10 58 38

  1. Done
  2. Done, but i'm not sure why we need those extra spans, take a look.
  3. Done
  4. I removed the id for the tooltip itself, theres an id for each of the Apps.

@jeff-phillips-18 I also changed the storybook structure to match the PF one, let me know what you think

@glekner glekner force-pushed the feature-applauncher branch from cbc761c to 43b797a Compare May 27, 2018 09:42
@jgiardino
Copy link
Collaborator

Hi @gilad215,

Thanks for making updates requested above! There's just one element that still doesn't match what's included in pf core:

  1. For this element: <span aria-describedby="tooltip" aria-hidden="true" class="fa fa- fa fa-th applauncher-pf-icon"></span>
    • It still includes a weird set of class names: fa fa- fa fa-th applauncher-pf-icon should just be fa fa-th applauncher-pf-icon
    • It still includes aria-describedby="tooltip". It looks like the tooltip for this icon was removed? If that's the case, this attribute that references it should also be removed. If you do keep this attribute, it should be moved to the parent <button> element.

@glekner glekner force-pushed the feature-applauncher branch from 43b797a to a1409c3 Compare June 3, 2018 07:33
@glekner
Copy link
Contributor Author

glekner commented Jun 3, 2018

@jgiardino fixed the element :)

@dabeng
Copy link
Contributor

dabeng commented Jun 4, 2018

Hi @gilad215 I find that launcher button will disappear when the width of window is less than 768px.

i988yxd300

onClick={onClick}
bsStyle="link"
className="nav-item-iconic dropdown-toggle"
aria-describedby="tooltip"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this value coming from? This should the the same value that displays as the tooltip id value, but it isn't obvious to me where the tooltip id value is being defined. When I look at the react-bootstrap documentation, they show examples of tooltip like this <Tooltip id={id}> with id as a required prop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, ill just change it:
overlay={<Tooltip id={tooltip}>{tooltip}</Tooltip>}
in the OverlayTrigger

@jgiardino
Copy link
Collaborator

@gilad215 I had to build your branch locally to see the updates, and they match what I was expecting. Thanks for the updates! I did have a question about about the tooltip, that I included in an inline comment.

Do you happen to know why the storybook isn't showing the latest updates? (adding @priley86 and @jeff-phillips-18 in case this is an issue with something in the repo, and also for feedback on my next comment...)

Re: @dabeng's comment:

I find that launcher button will disappear when the width of window is less than 768px.

This behavior comes from pf-core css—the css from core will not show the app launcher icon at a width less than 768px.

But in pf-core, the menu items in the app launcher menu will also get added to the vertical nav when the window is less than 768px in width. I'm assuming that this component is intended to support only the toggle and menu that display when the window is greater than 768px. But my question for everyone (@gilad215, @priley86, @jeff-phillips-18, @mturley) is how should the menu items be added to the vertical nav? Would that functionality be added to the vertical nav component? Is that something the consumer would manage? Do we need another issue to capture this aspect of the app launcher behavior?

@jeff-phillips-18
Copy link
Member

The items in right of the masthead (app launcher, help, user menu, notification drawer trigger) are meant to be added to the vertical nav at less than 768px. This is described in http://www.patternfly.org/pattern-library/navigation/vertical-navigation/#design in the Responsive States section.

@glekner glekner force-pushed the feature-applauncher branch from a1409c3 to 2db104a Compare June 6, 2018 11:31
@glekner
Copy link
Contributor Author

glekner commented Jun 6, 2018

@jgiardino changed overlay={<Tooltip id={tooltip}>{tooltip}</Tooltip>} in the OverlayTrigger
Also updated the Storybook

@jgiardino
Copy link
Collaborator

Awesome! Thanks, @gilad215! No further comments from me. Great job on this!

bitmoji

We also have issue #382 to address getting the app launcher into the vertical nav at smaller window sizes.

Copy link
Member

@jeff-phillips-18 jeff-phillips-18 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @gilad215!

@priley86 priley86 merged commit 0334b80 into patternfly:master Jun 14, 2018
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.

Component : Application Launcher
9 participants