refactor(EuiCopy): migrate from class to function component#9608
refactor(EuiCopy): migrate from class to function component#9608abhijnyan-codes wants to merge 2 commits intoelastic:mainfrom
Conversation
|
❌ Author of the following commits did not sign a Contributor Agreement: Please, read and sign the above mentioned agreement if you want to contribute to this project |
|
👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually? |
There was a problem hiding this comment.
Pull request overview
Refactors EuiCopy (clipboard-copy render-prop utility) from a class component to a function component using React hooks, while keeping the tooltip feedback behavior.
Changes:
- Converted
EuiCopyfromComponentto a function component - Replaced
this.statewithuseStatefortooltipText - Replaced
static defaultPropswith a default parameter value forafterMessage
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@abhijnyan-codes Could you please sign the CLA? 🙏🏻 It's important before contributing. Thanks! |
| * Optional props to pass to the EuiToolTip component. | ||
| */ | ||
| tooltipProps?: Partial< | ||
| tooltipProps?: Partial |
There was a problem hiding this comment.
@abhijnyan-codes This seems like a syntax error:
| tooltipProps?: Partial | |
| tooltipProps?: Partial< |
| }, [beforeMessage]); | ||
|
|
||
| return ( | ||
| // See `src/components/tool_tip/tool_tip.js` for explanation of below eslint-disable |
There was a problem hiding this comment.
@abhijnyan-codes we do need this comment by the eslint-disable:
// See
src/components/tool_tip/tool_tip.jsfor explanation of below eslint-disable
Let's please bring it back 🙏🏻
Closes #9466
Summary
Migrated
EuiCopyfrom a class component to a function component usinguseState.Changes
this.statewithuseStatehookstatic defaultPropswith default parameter value