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: add copy button for code #106

Merged
merged 7 commits into from
May 7, 2021
Merged

feat: add copy button for code #106

merged 7 commits into from
May 7, 2021

Conversation

ydcjeff
Copy link
Member

@ydcjeff ydcjeff commented May 5, 2021

Description

Part of #103

Add copy button for CodeBlock to copy the code

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Other

@netlify
Copy link

netlify bot commented May 5, 2021

Deploy preview for code-generator ready!

Built with commit a5e0951

https://deploy-preview-106--code-generator.netlify.app

@ydcjeff ydcjeff added this to In progress in v0.2.0 via automation May 5, 2021
@ydcjeff ydcjeff added the enhancement New feature or request label May 5, 2021
@ydcjeff ydcjeff requested review from trsvchn and vfdev-5 May 5, 2021 17:19
Comment on lines 60 to 61
setTimeout(() => (copyText.value = 'Copy'), 3000)
// alert('Code has been copied to clipboard.')
Copy link
Member Author

Choose a reason for hiding this comment

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

@vfdev-5 How do we want to show Code is being copied?
Currently, it changes "Copy" to "Copied" once clicked and revert back to "Copy" after 3 seconds. OR do you want to give an alert that code has been copied?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried "alert mode" locally and it's annoying when we click "Copy" again and again.

@ydcjeff ydcjeff mentioned this pull request May 5, 2021
23 tasks
@ydcjeff ydcjeff merged commit 4337ccd into v1 May 7, 2021
v0.2.0 automation moved this from In progress to Done May 7, 2021
@ydcjeff ydcjeff deleted the copy-btn branch May 7, 2021 04:18
ydcjeff added a commit that referenced this pull request May 21, 2021
* feat: add copy button for code

* chore: format

* refactor: use string template instead of template ref

* chore: remove alert code

* fix: try and catch error when copying code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant