Skip to content

Added copy-to-clipboard feature for code blocks and updated chapter c…#26

Open
raushan-2006 wants to merge 1 commit into
pushkarscripts:mainfrom
raushan-2006:copy-to-clipboard-feature
Open

Added copy-to-clipboard feature for code blocks and updated chapter c…#26
raushan-2006 wants to merge 1 commit into
pushkarscripts:mainfrom
raushan-2006:copy-to-clipboard-feature

Conversation

@raushan-2006
Copy link
Copy Markdown

🧩Components
CodeBlock, CopyToClipboard, UI/UX Enhancements

🔗 Related Issue
Fixes #9

📌 Description
This PR introduces a copy-to-clipboard feature for code snippets and command/terminal blocks across the platform to improve usability and developer experience.

The feature allows users to quickly copy code with a single click instead of manually selecting text, making the experience smoother—especially for longer snippets and mobile users.

✨Changes Made
Added a reusable copy-to-clipboard functionality for all code blocks
Implemented a copy button for code snippets and terminal/command sections
Added visual feedback on successful copy (e.g., “Copied!” state)
Ensured smooth behavior across desktop and mobile devices
Integrated the feature consistently with the existing UI/theme system
Added/updated CodeBlock.tsx component for centralized handling

🚀 Type of Change

  • ✅ New feature
  • ✅ UI/UX improvement

📸Screenshot/ Demo
Screenshot 2026-05-15 at 8 03 14 PM


🧪Testing Done
•Verified copy functionality for multiple code blocks in local dev environment.
•Checked responsive behavior on mobile viewports.
•Cross-browser testing performed on Chrome and Firefox.
•Confirmed no regressions in existing content rendering.


☑️Checklist

  • [ ✅] My code follows the project structure and conventions
  • [ ✅] I have tested the changes locally
  • [✅ ] I have linked the related issue properly
  • [✅ ] I have added screenshots where applicable
  • [ ✅] No existing functionality was broken

🤖AI Usage

  • [❎ ] I have not used AI tools for this contribution

  • [ ✅] I have used AI tools (ChatGPT, Copilot, Claude, etc.) and I have reviewed, verified, and understood all generated code/content before submitting this PR

If AI tools were used, briefly explain how:

AI assistance was used to improve the quality of PR documentation by helping with structuring, wording clarity, and formatting consistency across sections. The contributor independently implemented and tested all functional changes, ensured correctness in a local environment, and manually reviewed all AI-suggested text prior to submission.

🚀 Additional Notes
This feature improves developer experience by reducing friction when copying code. Future improvements may include:
Keyboard shortcut support (e.g., Ctrl+C on focused block)
Copy history indicator
Custom tooltip animations for better UX

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 15, 2026

Someone is attempting to deploy a commit to the PushkarScripts Team on Vercel.

A member of the Team first needs to authorize it.

@pushkarscripts
Copy link
Copy Markdown
Owner

Few nits:

  • Change the PR Description to match the style correctly.
  • Shift the copy button to any one of these places:
    image

@pushkarscripts pushkarscripts added enhancement New feature or request gssoc-26 Part of GirlScript Summer of Code 2026 gssoc:approved Approved for GSSOC '26 level:intermediate labels May 15, 2026
@raushan-2006
Copy link
Copy Markdown
Author

🧩Components
CodeBlock, CopyToClipboard, UI/UX Enhancements

🔗 Related Issue
Fixes #9

--

📌 Description
This PR Add a copy-to-clipboard button for code snippets and command blocks across the platform. It allows users to copy code with a single click, improving usability and making it easier to use on both desktop and mobile devices.

✨Changes Made
Added a reusable copy-to-clipboard functionality for all code blocks
Implemented a copy button for code snippets and terminal/command sections
Added visual feedback on successful copy (e.g., “Copied!” state)
Ensured smooth behavior across desktop and mobile devices
Integrated the feature consistently with the existing UI/theme system
Added/updated CodeBlock.tsx component for centralized handling

🚀 Type of Change

  • ✅ New feature
  • ✅ UI/UX improvement

📸Screenshot/ Demo
Screenshot 2026-05-16 at 2 11 16 AM


🧪Testing Done
•Verified copy functionality for multiple code blocks in local dev environment.
•Checked responsive behavior on mobile viewports.
•Cross-browser testing performed on Chrome and Firefox.
•Confirmed no regressions in existing content rendering.


☑️Checklist

  • [ ✅] My code follows the project structure and conventions
  • [ ✅] I have tested the changes locally
  • [✅ ] I have linked the related issue properly
  • [✅ ] I have added screenshots where applicable
  • [ ✅] No existing functionality was broken

🤖AI Usage

  • [❎ ] I have not used AI tools for this contribution

  • [ ✅] I have used AI tools (ChatGPT, Copilot, Claude, etc.) and I have reviewed, verified, and understood all generated code/content before submitting this PR

If AI tools were used, briefly explain how:

AI assistance was used to improve the quality of PR documentation by helping with structuring, wording clarity, and formatting consistency across sections. The contributor independently implemented and tested all functional changes, ensured correctness in a local environment, and manually reviewed all AI-suggested text prior to submission.

🚀 Additional Notes
This feature improves developer experience by reducing friction when copying code. Future improvements may include:
Keyboard shortcut support (e.g., Ctrl+C on focused block)
Copy history indicator
Custom tooltip animations for better UX

@pushkarscripts
Copy link
Copy Markdown
Owner

Few major problems here:

  • The css of the file breaks in C language Docs.
  • The headings from code blocks disappear (see image below)
    image
  • The image shared in PR description doesn't match with the actual implementation (atleast for C language)
  • The PR description is still not as per requirement.
    • Unnecessary emojis
    • Wrong markdown tags
    • Incorrect hierarchy between headings, subheadings and body.

Take your time but send an improved version of this PR with all the necessary changes made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gssoc:approved Approved for GSSOC '26 gssoc-26 Part of GirlScript Summer of Code 2026 level:intermediate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Copy Button for Code Blocks

2 participants