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

copy button that copies text to clipboard #1112

Merged
merged 11 commits into from
Aug 14, 2018
3 changes: 1 addition & 2 deletions src/components/copy/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ EuiCopy.propTypes = {
* Tooltip message displayed after copy function is called that lets the user know that
* 'textToCopy' has been copied to the clipboard.
*/
afterMessage: PropTypes.string,
afterMessage: PropTypes.string.isRequired,

/**
* Function that must return a Component. First argument is 'copy' function.
Expand All @@ -75,7 +75,6 @@ EuiCopy.propTypes = {
};

EuiCopy.defaultProps = {
beforeMessage: 'Copy',
afterMessage: 'Copied',
};

4 changes: 2 additions & 2 deletions src/components/tool_tip/tool_tip.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class EuiToolTip extends Component {
);

let tooltip;
if (visible) {
if (visible && content) {
Copy link
Contributor

@cchaos cchaos Aug 14, 2018

Choose a reason for hiding this comment

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

Sorry, one last thing, but because tooltips accept title's as well can you change this to be if (visible && (content || title))

tooltip = (
<EuiPortal>
<EuiToolTipPopover
Expand Down Expand Up @@ -205,7 +205,7 @@ EuiToolTip.propTypes = {
/**
* The main content of your tooltip.
*/
content: PropTypes.node.isRequired,
content: PropTypes.node,

/**
* An optional title for your tooltip.
Expand Down