Skip to content

refactor(EuiCopy): migrate from class to function component#9608

Open
abhijnyan-codes wants to merge 2 commits intoelastic:mainfrom
abhijnyan-codes:fix/eui-copy-class-to-function
Open

refactor(EuiCopy): migrate from class to function component#9608
abhijnyan-codes wants to merge 2 commits intoelastic:mainfrom
abhijnyan-codes:fix/eui-copy-class-to-function

Conversation

@abhijnyan-codes
Copy link
Copy Markdown

Closes #9466

Summary

Migrated EuiCopy from a class component to a function component using useState.

Changes

  • Replaced class component with function component
  • Replaced this.state with useState hook
  • Replaced static defaultProps with default parameter value
  • Removed constructor

Copilot AI review requested due to automatic review settings April 22, 2026 23:27
@abhijnyan-codes abhijnyan-codes requested a review from a team as a code owner April 22, 2026 23:27
@cla-checker-service
Copy link
Copy Markdown

cla-checker-service Bot commented Apr 22, 2026

❌ Author of the following commits did not sign a Contributor Agreement:
00b1e06, 98693c1

Please, read and sign the above mentioned agreement if you want to contribute to this project

@github-actions
Copy link
Copy Markdown

👋 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?

@github-actions github-actions Bot added the community contribution (Don't delete - used for automation) label Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 EuiCopy from Component to a function component
  • Replaced this.state with useState for tooltipText
  • Replaced static defaultProps with a default parameter value for afterMessage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eui/src/components/copy/copy.tsx Outdated
Comment thread packages/eui/src/components/copy/copy.tsx
@weronikaolejniczak weronikaolejniczak added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Apr 24, 2026
@weronikaolejniczak
Copy link
Copy Markdown
Contributor

@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
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.

@abhijnyan-codes This seems like a syntax error:

Suggested change
tooltipProps?: Partial
tooltipProps?: Partial<

}, [beforeMessage]);

return (
// See `src/components/tool_tip/tool_tip.js` for explanation of below eslint-disable
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.

@abhijnyan-codes we do need this comment by the eslint-disable:

// See src/components/tool_tip/tool_tip.js for explanation of below eslint-disable

Let's please bring it back 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution (Don't delete - used for automation) skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EuiCopy] Migrate from class to function component

3 participants