Skip to content

Conversation

Ron-Lavi
Copy link
Collaborator

When an item is disabled,
the user won't be able to move it between the lists:
dec 16 2018 4_22 pm

@patternfly-build
Copy link
Contributor

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

@coveralls

This comment has been minimized.

@Ron-Lavi Ron-Lavi force-pushed the fix/dual-list-disabled branch from a783e00 to fdbb08d Compare December 16, 2018 15:53
hidden: false
hidden: false,
disabled: false,
tooltipID: `dual-list-item-tooltip-${UUID()}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This only runs once at module import. Not when the component is instantiated so if someone mounts multiple of these they will all share the same id.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wow thanks.. I didn't know that..
maybe set the ID by the item side+position which is unique enough

Copy link
Member

@jeff-phillips-18 jeff-phillips-18 Dec 17, 2018

Choose a reason for hiding this comment

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

What we've done in other components is to set the default to null then use it like:

const randomId = () => Date.now();
...
<Tooltip id={tooltipID || randomId()}>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tell me what do you think, added this:

const getTooltipID = () => {
    let uniqueTooltipID = `dual-list-item-tooltip-${side}`;
    if (parentPosition) {
      uniqueTooltipID += `-${parentPosition}`;
    }
    uniqueTooltipID += `-${position}`;
    return uniqueTooltipID;
  };

and then using it like this when the default tooltipID is null.

    <DualListItemTooltip text={tooltipText} id={tooltipID || getTooltipID()}>

@Ron-Lavi Ron-Lavi force-pushed the fix/dual-list-disabled branch from fdbb08d to 0086e3a Compare December 18, 2018 09:12
@@ -0,0 +1,30 @@
import React from 'react';
import PropTypes from 'prop-types';
import UUID from 'uuid/v1';
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer not to pull this in and just use the Data.now() function for a unique ID.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops, forgot to remove this one..
what do you think of the implementation above? isn't it unique enough ?
thanks

Copy link
Member

Choose a reason for hiding this comment

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

Yup. Thanks.

@Ron-Lavi Ron-Lavi force-pushed the fix/dual-list-disabled branch from 0086e3a to 8638362 Compare December 18, 2018 15:02
&.disabled {
cursor: not-allowed;
background: @color-pf-black-150;
color: @color-pf-black-500;
Copy link
Member

Choose a reason for hiding this comment

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

nit. supposed to be in alphabetical order.

Copy link
Member

Choose a reason for hiding this comment

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

we haven't been keeping up with that in this repo

@jeff-phillips-18 jeff-phillips-18 merged commit ddc0e8e into patternfly:master Dec 18, 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.

7 participants