Skip to content

Conversation

@tandpfun
Copy link
Contributor

@tandpfun tandpfun commented Sep 4, 2021

Using the incomplete copy button code, I fixed some stuff and added some styles to make it appear when hovering over code blocks.
I made it only visible on desktop for now, I'm not sure how to implement it for mobile yet.

image

text-decoration: none;
}

code .copy-button {
Copy link
Owner

Choose a reason for hiding this comment

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

I kind of like it always visible so people know it exists 🤔 but I am am willing to be told "no" lol

I do think it should be the upper right corner though, consistent with most of what I see online

}

const hasCopy = props.copy || language === "copy";
const hasCopy = /*props.copy || language === "copy"*/ true;
Copy link
Owner

Choose a reason for hiding this comment

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

Do we want everything to be copyable? Wondering if it makes more sense to make this opt-in instead

(For opt in, you would do this:

```json copy
code

Copy link
Contributor

@lavgup lavgup Sep 4, 2021

Choose a reason for hiding this comment

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

Think it would make more sense for it to be opt-out rather than opt-in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we were to go with a make every languaged code copyable route, some stuff like URLs and weird examples wouldn't be copyable.
If we were to go with an opt in version, we'd have to update the docs a ton
If we were to go with an opt out version, we'd still have to update the docs, but it might be the easiest method.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think opt in is better, most of the docs don't need to be copyable (e.g. example objects)

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.

4 participants