-
Notifications
You must be signed in to change notification settings - Fork 114
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 optional filename prop for CodeSnippet #216
Conversation
<div className={styles.fileName}> | ||
{fileName && ( | ||
<MiddleEllipsis> | ||
<span title={fileName}>{fileName}</span> |
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.
Out of curiosity, do we have any kind of UX figured out where a user could see the full path? If the value ends up truncated, it might be a bit frustrating if they want to get some context on the full file path.
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 should have looked at the preview before saying anything. It looks like MiddleEllipsis
adds a title
attribute which addresses my concern.
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.
The rational for adding the title attribute to the span was to, at least on desktop browsers, make it possible to see the full path even if it is truncated. Beyond that, no, not yet. It'd be great to have a more robust solution that also supports copying.
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Adds ability to create display the filename for a markdown CodeSnippet component by adding
fileName=src/example/filename.js
to the prop definition line.Truncates the filename in the middle if it is too long to fit in the copy bar.
Reviewer Notes
You can see the truncation by going to the guides/example page and changing the browser width.
Related Issue(s) / Ticket(s)
Screenshot(s)