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(copy-updates): align copy component impl with latest designs #444

Merged
merged 1 commit into from Aug 10, 2018

Conversation

seanforyou23
Copy link
Contributor

This PR updates the copy clipboard components to use the latest designs and interactions specified in core.

One outstanding issue that I'm not sure how to resolve is that the tooltip text for the copy buttons updates to "Copied" for a few seconds after firing the copy action, however this value isn't updated in the DOM until you move your cursor away from the copy button and then back over the top of it again. I'm using property bound [tooltip] syntax which I thought would handle this but doesn't seem to. Any idea how to solve this?

make widths configurable
improve tests
add tooltip for copy buttons
specify tooltip container to fix tooltip flutter
use input element for copy value container
remove redundant triggers
clean up view templates
use obj for storing common values in copyBase
use readonly input instead of span so copy value is scrollable
use tooltipText input prop instead of tooltip to avoid namespace collision
specify body for container attribute to fix tooltip styling issues
avoid breaking changes by setting buttonAriaLabel to buttonLabel value when passed in
update tests to use new property name

@patternfly-build
Copy link
Contributor

patternfly-build commented Aug 8, 2018

Deploy preview for patternfly-ng ready!

Built with commit b640c9e

https://deploy-preview-444--patternfly-ng.netlify.com

copyBtnTooltipPlacement: 'top',
copyBtnTooltipText: 'Copy to Clipboard',
copiedTooltipText: 'Copied'
};
Copy link
Member

@dlabrecq dlabrecq Aug 8, 2018

Choose a reason for hiding this comment

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

Please move the defaults to the corresponding inputs in this class. It looks like only "Copied" is used more than once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See latest updates, we're using 'Copy to Clipboard' and 'Copied' potentially twice so I left those in a defaults object, but if it still doesn't make sense - happy to move them out of here. Let me know what you think!

setTimeout(() => {
this._recentlyCopied = false;
this.copyBtnTooltipText = this._copyDefaults.copyBtnTooltipText;
Copy link
Member

@dlabrecq dlabrecq Aug 8, 2018

Choose a reason for hiding this comment

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

This is a little weird. The "Copied" tooltip appears to be set to the same default value twice; once on line 87, then on line 90 in the timeout? How is the tooltip restored to the original copyBtnTooltipText value provided by the developer?

this.copyBtnTooltipText = this._copyDefaults.copiedTooltipText;

Do we need to provide another tootltip property (e.g., tooltipCopiedText), so devs can localize their own "Copied" text?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Yes I think adding a dedicated property for the copied msg is the way to go, adding that to my latest changes. Also, there wasn't a way to restore to the original copyBtnTooltipText, so adding that as well.

/**
* A width to set on the copy container
*/
@Input('width') width: string;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a default width for the pfng-block-copy selector? Just wondering what happens when this property is not provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're basically not setting a default width so the inline copy remains inline flow content out of the box.

Block copy is encased within a div which is block level by default so it will occupy 100% of available width in the parent element.

Because the width is a shared property between inline and block, not setting a default value here seemed to make most sense. I could set width: 100% on .pfng-block-copy if you think this will become a tripping hazard for devs.

Copy link
Member

Choose a reason for hiding this comment

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

That is fine. I was more curious if setting width was a requirement

dlabrecq
dlabrecq previously approved these changes Aug 9, 2018
Copy link
Member

@dlabrecq dlabrecq left a comment

Choose a reason for hiding this comment

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

LGTM

improve tests
fix tooltip flutter
add tooltip for copy buttons
use input element for copy value container
remove redundant triggers
clean up view templates
use obj for storing common values in copyBase

add project flag to tslint script to avoid "rule requires type information" warning
use readonly input instead of span so copy value is scrollable
use tooltipText input prop instead of tooltip to avoid namespace collision
both focus and hover can launch a tooltip
specify body for container attribute to fix tooltip styling issues
avoid breaking changes by setting buttonAriaLabel to buttonLabel value when passed in
update tests to use new property name
@patternfly-build
Copy link
Contributor

🎉 This PR is included in version 4.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

None yet

3 participants