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 #698

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: add copy button #698

wants to merge 4 commits into from

Conversation

xbinaryx
Copy link

Prerequisites checklist

What is the purpose of this pull request?

While reading the ESLint CSS support post, I noticed the code blocks lacked a copy button. I had to select and copy the text manually.

What changes did you make? (Give an overview)

I added a copy button to code blocks.

Related Issues

Is there anything you'd like reviewers to focus on?

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for new-eslint ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/new-eslint/deploys/67d06fe4d4aeb50008636f7f
😎 Deploy Preview https://deploy-preview-698--new-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for zh-hans-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/zh-hans-eslint/deploys/67d06fe4bbc9ef00070e79a3
😎 Deploy Preview https://deploy-preview-698--zh-hans-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for ja-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/ja-eslint/deploys/67d06fe44b0139000885ca75
😎 Deploy Preview https://deploy-preview-698--ja-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for es-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/es-eslint/deploys/67d06fe46aff760008088ea2
😎 Deploy Preview https://deploy-preview-698--es-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for fr-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/fr-eslint/deploys/67d06fe456de800008241c30
😎 Deploy Preview https://deploy-preview-698--fr-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for de-eslint ready!

Name Link
🔨 Latest commit 1334427
🔍 Latest deploy log https://app.netlify.com/sites/de-eslint/deploys/67c1144f90bb8a00081dd9f3
😎 Deploy Preview https://deploy-preview-698--de-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for pt-br-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/pt-br-eslint/deploys/67d06fe4f541b000087bcd83
😎 Deploy Preview https://deploy-preview-698--pt-br-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for hi-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/hi-eslint/deploys/67d06fe4ff46c10008b95483
😎 Deploy Preview https://deploy-preview-698--hi-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for de-eslint ready!

Name Link
🔨 Latest commit 0138754
🔍 Latest deploy log https://app.netlify.com/sites/de-eslint/deploys/67d06fe4d573f800088f7ee5
😎 Deploy Preview https://deploy-preview-698--de-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@Tanujkanti4441 Tanujkanti4441 left a comment

Choose a reason for hiding this comment

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

Hi @xbinaryx, thanks for the PR.

Right now copy button appears on hover, as also suggested in this comment we we can make the button and its background appear always?

Also it overrides the content behind it like in these examples
Screenshot 2025-02-28 185416
or
Screenshot 2025-02-28 185434

should we place it on border as we do with correct/incorrect logo something like this

Screenshot 2025-02-28 185834

Would like more opinions on this from team.

@xbinaryx
Copy link
Author

xbinaryx commented Mar 3, 2025

Hi @Tanujkanti4441, thanks for the review!

I'm thinking about two designs:

We could make the code block a flexbox row, like GitHub's code blocks.

Screenshot 2025-03-03 081937

Or, we could make the copy button a bit transparent, like with opacity: 0.75.

deploy-preview-698--new-eslint netlify app_blog_2025_02_eslint-css-support_(iPhone 12 Pro)

What do you think?

@Tanujkanti4441
Copy link
Contributor

Hi @Tanujkanti4441, thanks for the review!

I'm thinking about two designs:

We could make the code block a flexbox row, like GitHub's code blocks.
Or, we could make the copy button a bit transparent, like with opacity: 0.75.
What do you think?

As we can see in provided images in #698 (review) in both examples, copy button will overlap the code, but for me it's either copy button like GitHub's code block or one i suggested in #698 (review)

let's have some opinions from @eslint/eslint-team.

@Tanujkanti4441
Copy link
Contributor

Tanujkanti4441 commented Mar 9, 2025

Hi @xbinaryx, for now can you make the copy button appear all the time with its background, like github code block?

Screenshot 2025-02-28 185434

we can later change it's position if overriding code will be an issue.

@xbinaryx
Copy link
Author

xbinaryx commented Mar 9, 2025

@Tanujkanti4441 The copy button should always be visible now and not overlap the code.

Copy link
Member

Choose a reason for hiding this comment

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

Filenames should be in dash-case, so please rename to pre-wrapper.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Triaging
Development

Successfully merging this pull request may close these issues.

3 participants