Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Add copy button to code snippets #27

Closed
mrkldshv opened this issue May 31, 2022 · 6 comments · Fixed by #51
Closed

Add copy button to code snippets #27

mrkldshv opened this issue May 31, 2022 · 6 comments · Fixed by #51

Comments

@mrkldshv
Copy link

Currently, it's not easy to copy code snippet from the example. When I'm trying to copy code by selecting it with mouse, this copies both the description and the code snippet. I think it would be great to add copy button to the code snippets. As alternative solution, we can adjust layout to make copying code using mouse easier.

@LeoDog896
Copy link
Contributor

Does anyone have any ideas about where to place the copy to clipboard button per code block?

@lino-levan
Copy link
Contributor

@LeoDog896 this would probably be done here

function SnippetComponent(props: {

@LeoDog896
Copy link
Contributor

Sorry about the bad wording -- more of a design question, but that helps too!

@lino-levan
Copy link
Contributor

Ah okay, that makes more sense. I would place it in the top right of the box because that seems to be the standard.

See: https://vitejs.dev/guide/

@lino-levan
Copy link
Contributor

I think this requires some design work. @hashrock (sorry for the ping), are you aware of a deno-style copy svg? I wasn't able to find any official deno projects with a copy button.

@hashrock
Copy link
Contributor

I think we can use this svg:

https://github.com/denoland/doc_components/blob/main/icons.tsx#L91

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants