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

Fixed #39 Added a copy button to the required codes in the docs section #42

Closed

Conversation

AnshumanDhiman
Copy link
Member

Fixes #39
I have added copy button (copy icon basically imported from the eos-library) working as a button.
When a user clicks on the icon it copies the text written in the code section.
I have to create a separate file named as linksData.js which keeps all the links available on the docs page and I have mapped them to copy.

await navigator.clipboard
.writeText(copyText)
.then(() => {
alert('Successfully Copied')
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need alert for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok I will update this

const copyToClipboard = async (value) => {
let copyText
linkData.map((val) => {
if (val.classname === value) {
Copy link
Member

Choose a reason for hiding this comment

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

We are already having copy button and it has the logic of copying a string, can we reuse that function. If it is made in a component, move it to some global level for whole app to reuse it

Copy link
Member Author

Choose a reason for hiding this comment

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

image_2022-02-14_233426
Sir can you confirm this copy button ?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

there is also one more in customize icon modal. My point is we shouldn't rewrite the code. Let's try to reuse what's already been written

Copy link
Member Author

@AnshumanDhiman AnshumanDhiman Feb 15, 2022

Choose a reason for hiding this comment

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

I saw the code which was written for these. Actually we here we are using input tags and while copying the select() is used to copy for which input tag is necessary. But in the docs sections we have used code tag so it is throwing error when I am trying that way.
This is the code which is used to copy before in the customize model.
ch2
If we use the input tag it looks like this which does not look good
image_2022-02-15_214447

One thing we can do is we can use input tags inside code tag and make them display none so that they won't be displayed and also perform the functionality like the other one's are doing.
ch1

Please help me regarding this

Copy link
Member

Choose a reason for hiding this comment

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

Maybe this is a good opportunity to refactor the copy comppnent and separate, as much as possible, the logic from the view. Can you try this approach?

The method could depend on a state that's passed or returned to any view component.

@kaybhutani
Copy link
Member

can you also add a screenshot @AnshumanDhiman ?

@AnshumanDhiman
Copy link
Member Author

This is the current state of the EOS Icons page
curr

This is the EOS Icons page after the recent changes added
1
2
3

@kaybhutani
Copy link
Member

The design looks good @AnshumanDhiman, let me know once you resolve the comments

@AnshumanDhiman
Copy link
Member Author

AnshumanDhiman commented Feb 24, 2022

@cyntss @kbhutani0001 I have added a new function file copyToClipboard.js , now if we add an input tag we just have to add "id=copy-code" and it will copy the code and if we use the code tag we have to add the link to be copied in linkData.js file and it will copy it. Also issue #45 specifies to show notification when an item is copied, so I have not removed the alert() functionality, but as @kbhutani0001 sir said if it is not necessary I will remove it.

@vinayaksh42
Copy link
Member

@AnshumanDhiman Can you resolve the conflicts?

@AnshumanDhiman
Copy link
Member Author

I have asked @kbhutani0001 sir actually I tried manually resolving the conflicts, but it is still showing conflicts and then I tried to push updated code thorough vscode but it is throwing me error of rejected

@kaybhutani
Copy link
Member

@AnshumanDhiman let's connect for this. can you share the errors with me on slack?

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.

Add Copy Button in the Docs Section
4 participants