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

feat(tooltip): allow tooltip text to be left-aligned by jenny-s51 · Pull Request #3053 · patternfly/patternfly-react · GitHub

feat(tooltip): allow tooltip text to be left-aligned - #3053

Merged
dlabrecq merged 6 commits into
patternfly:masterfrom
jenny-s51:iss3013
Oct 11, 2019
Merged

feat(tooltip): allow tooltip text to be left-aligned#3053
dlabrecq merged 6 commits into
patternfly:masterfrom
jenny-s51:iss3013

Conversation

Copy link
Copy Markdown
Contributor

will close #3013

Copy link
Copy Markdown
Collaborator

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

codecov-io commented Oct 3, 2019
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #3053 into master will decrease coverage by <.01%.
The diff coverage is 75%.

@@            Coverage Diff             @@
##           master    #3053      +/-   ##
==========================================
- Coverage   69.02%   69.02%   -0.01%     
==========================================
  Files         858      858              
  Lines       23413    23416       +3     
  Branches     1853     1854       +1     
==========================================
+ Hits        16160    16162       +2     
- Misses       6333     6334       +1     
  Partials      920      920
Flag Coverage Δ
#misc 95.45% <ø> (ø) ⬆️
#patternfly3 69.22% <ø> (ø) ⬆️
#patternfly4 68.09% <75%> (-0.01%) ⬇️
Impacted Files Coverage Δ
...ly-4/react-core/src/components/Tooltip/Tooltip.tsx 84.48% <100%> (+0.27%) ⬆️
...mponents/TopologyControlBar/TopologyControlBar.tsx 45.12% <100%> (ø) ⬆️
...act-core/src/components/Tooltip/TooltipContent.tsx 80% <50%> (-20%) ⬇️
...patternfly-react/src/components/Tooltip/Tooltip.js 94.18% <0%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 650c823...c282699. Read the comment docs.

jenny-s51 changed the title WIP(tooltip): allow tooltip text to be left-aligned feat(tooltip): allow tooltip text to be left-aligned Oct 3, 2019

redallen commented Oct 3, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Very close to CI passing:

Snapshot Summary
 › 2 snapshots failed from 1 test suite. Inspect your code changes or run `yarn run test:pf4 -u` to update them.

Test Suites: 1 failed, 157 passed, 158 total
Tests:       2 failed, 849 passed, 851 total
Snapshots:   2 failed, 621 passed, 623 total

/** Tooltip trigger: click, mouseenter, focus, manual */
trigger?: string;
/** Flag to indicate that the text content is left aligned */
isContentLeftAligned?: boolean;

dlabrecq Oct 4, 2019
edited
Loading

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

Why only support a left aligned option? What if designers want to support right-aligned content, next?

Even if we don't support right-aligned content for now, something more like this would scale better in the future.

contentPosition?: 'bottom' | 'center' | 'right';

Then we could create an enum

export enum TooltipContentPosition {
  bottom = 'bottom',
  center = 'center',
  right = 'right'
}

Looks like we already take this approach for the position property.

jenny-s51 Oct 5, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

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

Sure, I'm happy to add a right-aligned option. I was also wondering why this issue was opened for left-aligned text only. @dlabrecq @tlabaj would you prefer I open a new issue to add support for right-aligned content? Or add an enum to this PR instead, like you have above?

Copy link
Copy Markdown
Contributor Author

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

@dlabrecq @tlabaj I've opened a separate issue for this at #3089. If agreeable with you, I'm happy to assign myself to it and add support right-aligned content as well.

dlabrecq Oct 8, 2019
edited
Loading

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

I wasn't necessarily asking for right-aligned tooltips, just that we use a property that is more scalable. Once we introduce the isContentLeftAligned prop, it will be difficult to change without a breaking change. That's why I suggested we use something more like the existing position property.

I just want to consider a use case where we end up with both isContentLeftAligned and isContentRightAligned props together? Or, would it be better to have something more like contentPosition?: 'bottom' | 'center' | 'right' where we can easily add future support.

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

Dan makes good point here. I don't think there are plans of introducing the right aligned variant and the naming here seems to be consistent with other components. That being said those components would be hard to change if we added another variant.

jenny-s51 Oct 10, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

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

@tlabaj Thank you for your feedback! Does that mean I should change the prop to look like contentPosition?: 'left' | 'center'? Or did you mean that this PR is okay the way it is?

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

If you don't feel we'll ever have another variant, I'm fine leaving it as is. Just wanted to raise the question.

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

@jenny-s51 I think we should use contentPosition?: 'left' | 'center'. It's also consistent with the position enum we are already using in this component. Can we change it to that?

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

@jenny-s51 I like what @dlabrecq suggested. But, if we are not going to have a right alignment variation I don't see the need to introduce the inconstancy. We have at least one other component that uses isLeftAligned (or similar).
@mcarrano can you verify that there is no intent on introducing a right aligned variant.

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

I see no reason to support right-aligned tooltips.

redallen left a comment
edited
Loading

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, unused import doesn't affect anything.

cssPrefix: 'pf-c-tooltip'
typescript: true
propComponents: ['Tooltip']
propComponents: ['Tooltip', 'TooltipContent']

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

Good catch, we export TooltipContent in Tooltip/index.ts but don't show its props in the docs.

Edit: We should add a followup issue to provide examples on how/why to use TooltipContent.

Copy link
Copy Markdown
Contributor Author

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

All set! #3088

---

import { Button, Tooltip, TooltipPosition, Checkbox } from '@patternfly/react-core';
import { Button, Tooltip, TooltipPosition, TooltipContent, Checkbox } from '@patternfly/react-core';

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

Unused import.

mcoker 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, thanks @jenny-s51!!

tlabaj self-assigned this Oct 11, 2019

dlabaj 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

Can you update this to use contentPosition?: 'left' | 'center'`

/** Tooltip trigger: click, mouseenter, focus, manual */
trigger?: string;
/** Flag to indicate that the text content is left aligned */
isContentLeftAligned?: boolean;

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

@jenny-s51 I think we should use contentPosition?: 'left' | 'center'. It's also consistent with the position enum we are already using in this component. Can we change it to that?

jenny-s51 requested a review from dlabaj October 11, 2019 16:22

dlabaj 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

After looking at what we do elsewhere it seems we should go with IsContentLeftAligned. We only seem to use the enum when there are more than one style, and we are using IsLeftAligned elsewhere through out the product.

dlabrecq merged commit d369c07 into patternfly:master Oct 11, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow tooltip text to be left-aligned

9 participants


Back | FazBrowse Home | New Git URL