Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Feb 17, 2021

Fixes #2743.

The visual overflow happens because empty code blocks are too small to contain the clipboard button. On top of that, a clipboard button seems pointless as there's nothing to copy. So I just removed it.

@ghost ghost self-requested a review February 17, 2021 21:45
Copy link
Collaborator

@vdonato vdonato left a comment

Choose a reason for hiding this comment

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

Would be good to add an enzyme test for this if it's not too much effort (mostly I'm not sure how much work it is to get the copy button to actually show up/not show up since in the real world it happens on mouse hover).

Also I believe this probably needs @asaini to glance at it since it's technically a user-facing behavior change

@ghost
Copy link
Author

ghost commented Feb 18, 2021

@vdonato Ok, I removed the _.isEmpty() reference.

As @kantuni requested, here's the refactor in a separate PR.

Just waiting on @asaini for product review now.

@ghost ghost mentioned this pull request Feb 18, 2021
Copy link
Collaborator

@vdonato vdonato left a comment

Choose a reason for hiding this comment

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

There's also still a test to write if it's feasible 🙂

Brandon Hsiao added 2 commits February 19, 2021 09:06
@ghost
Copy link
Author

ghost commented Feb 19, 2021

Added test and fixed typo.

Turned out, no need to check hover in test, just need to check if the copy button is mounted or not.

@asaini
Copy link

asaini commented Feb 26, 2021

LGTM 👍

@ghost ghost merged commit 0010aea into streamlit:develop Feb 26, 2021
tconkling added a commit that referenced this pull request Mar 1, 2021
* develop: (29 commits)
  Update bug_report.md
  Refactor CodeBlock.tsx (#2814)
  Remove copy button for empty codeblocks (#2808)
  Add image format deprecation config with expiration (#2865)
  Remove unneeded "use_column_width=True" from our doc examples (#2692)
  Extend our st.cache MagicMock handling logic to Mock (#2846)
  save work (#2862)
  Remove .stale-element class (#2848)
  Release 0.77 (#2849)
  Fix watchdog import failure (#2856)
  🔥 Fully remove `format` param from st.image (#2637)
  Don't memoize config._server_headless (#2858)
  hide empty columns on mobile (#2756)
  st.beta_secrets (#2757)
  `watch_file` utility function (#2851)
  Align st.beta_columns  (#2811)
  Update "showErrorDetails" config description and docs (#2841)
  Pause Dependabot updates for non-security-related issues (#2840)
  client.showTracebacks -> showErrorDetails (per product) (#2837)
  Color picker - show value (#2817)
  ...
This pull request was closed.
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.

'Copy to Clipboard' icon location is off

4 participants