-
Notifications
You must be signed in to change notification settings - Fork 841
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
Add vertical scroll and text highlighting for functions #3918
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
I think the code highlight is a great advantage! I will say though, I really think it's important not to force text-wrap on code elements. For the same reason why code editors don't wrap lines by default. It's really hard to read what is the whole word. That said, I haven't thought through a real solution, I just know that forcing word-wrap should not be the solution here. |
@chandlerprall suggested adding a vertical scroll for functions so they will be displayed in a single line. I tried that but I couldn't find which component is causing the word-wrap |
Jenkins, test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3918/ |
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3918/ |
|
So Is there anyway to remove the word wrap completely to use vertical scrolling. I think that would be more readable for functions. |
Likely with CSS, yes. |
Sorry, I think I'm a bit confused as to what this is trying to accomplish. I don't think we should limit the height of any of the cells enforcing a scrollbar. They should always be fully visible. If that means we have to have word breaks, that's fine for now. |
Ah, yeah, so this doesn't add vertical scroll, it add horizontal scroll if necessary. Height is never restricted. |
I meant horizontal scroll everywhere in place of vertical scroll. Sorry I messed !! |
if (functionMatches[j]) { | ||
elements.push( | ||
<EuiCode> | ||
<span className="eui-textBreakNormal">{types[i]}</span> | ||
</EuiCode> | ||
); | ||
elements.push( | ||
<EuiCode language="ts">{functionMatches[j][0]}</EuiCode> | ||
); | ||
j++; | ||
} else { | ||
elements.push( | ||
<EuiCode> | ||
<span className="eui-textBreakNormal">{types[i]}</span> | ||
</EuiCode> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on a direct fix for the overflow stuff, but can you help me better understand when each of these get displayed? Like what does functionMatches
do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my idea actually here is to find all functions and display them inline using horizontal scroll as suggested here #3554 (review) under long type rendering. I wasn't able to achieve that due to word-wraps. so that I commented it here but unfortunately. I used vertical
instead of horizontal
and messed things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on a direct fix for the overflow stuff, but can you help me better understand when each of these get displayed? Like what does
functionMatches
do?
Also functions may appear sometimes in enums
also so in that case i tried to extract functions from those enums using regex also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, so we want the multiple version to horizontally scroll. Ok, let me actually keep playing with my branch off of yours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, that was the idea.
@ashikmeerankutty I had to play around with how the table cell styles were interacting with the code blocks so I just ended up creating a PR for you. ashikmeerankutty#6 I see though that all Fragments still need a |
Thank you so much. I will add them |
Swap usages of code for code block and fix overflow
jenkins test this |
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3918/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
* Add vertical scroll and text highlighting for functions * use code block instead of markdown * Swap usages of code for code block and fix overflow * One codeblock with line breaks when multiple functions * Fixed warnings of missing keys Co-authored-by: cchaos <caroline.horn@elastic.co>
Summary
Makes progress on #3056
Before:
After:
Checklist
- [ ] Props have proper autodocs- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Added or updated jest tests- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes- [ ] A changelog entry exists and is marked appropriately