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 to clipboard button to markdown code block #2025 #2120

Merged
merged 26 commits into from
Sep 6, 2023

Conversation

marek-mihok
Copy link
Contributor

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

This PR reuses the button from ui.copyable_text also for markdown code block.

Screen.Recording.2023-08-28.at.10.53.21.mov

Closes #2025

@marek-mihok marek-mihok marked this pull request as ready for review August 30, 2023 08:30
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

Thanks @marek-mihok!

  • Using portals seems like overkill. Can we do without?
  • The button on dark md syntax highlight blends into background and is barely visible. Can this be improved?
  • The tests that check if button is rendered are unnecessary, we have visual regression tests for that. Hover ones are ok.

@marek-mihok
Copy link
Contributor Author

Using portals seems like overkill. Can we do without?

We can, please check the updated solution. I've reused the original approach we used for copyable_text and applied the same principle also for markdown code block.

The button on dark md syntax highlight blends into background and is barely visible. Can this be improved?

Improved by adding the outline.

The tests that check if button is rendered are unnecessary, we have visual regression tests for that. Hover ones are ok.

Good point. Removed ✅

ui/src/copyable_text.tsx Outdated Show resolved Hide resolved
ui/src/copyable_text.tsx Outdated Show resolved Hide resolved
ui/src/copyable_text.tsx Outdated Show resolved Hide resolved
ui/src/copyable_text.tsx Outdated Show resolved Hide resolved
ui/src/copyable_text.tsx Outdated Show resolved Hide resolved
ui/src/markdown.tsx Outdated Show resolved Hide resolved
ui/src/copyable_text.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

Thanks @marek-mihok!

I fixed the icon centering + removed some more unnecessary code.

@mturoci mturoci merged commit 54c0553 into main Sep 6, 2023
2 checks passed
@mturoci mturoci deleted the feat/issue-2025 branch September 6, 2023 06:29
marek-mihok added a commit that referenced this pull request Jan 15, 2024
Co-authored-by: Martin Turoci <martin.turoci@h2o.ai>
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 to clipboard button when hovered over markdown code block.
2 participants