Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
added notes about JLIcon's design to README #7782
added notes about JLIcon's design to README #7782
Changes from 1 commit
c5a7737
fcd16f5
a297d5d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
So the string ids need to be unique? So we probably want to encourage namespacing the strings with the package name, like
'ui-components:myicon'
?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.
@jasongrout Though I don't love the idea of making the naming convention any more complex/verbose (eg under the current convention given an svg file
my-icon.svg
the corresponding icon name would just bemy
), I agree that your namespacing suggestion is the best practice going forward.I see two issues (all dependent on the current implementation of JLIcon):
Purely to provide a shim for backwards compatibility, the names
foo-bar
andjp-fooBarIcon
are considered equivalent. This is due to the prevalence ofjp-fooBarIcon
style icon class names in current codebase (both core and extensions). How to implement both this shim and namespacing?Until you brought this up, I hadn't fully thought through what happens in the case where more than one JLIcon instances are defined using the same name. Currently, this is undefined behavior. What should happen? Two possibilities:
a. no exception, conflicts are resolved by using the most recent definition (currently, this would be hard to implement. Would need to first fully implement render-on-replace-svg behavior, or you might end up rendering a different icon for each definition).
b. exception on redefinition (maybe just a warning), only ever use the first definition of an icon.
I am open to suggestions on how to deal with the above.
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.
That sounds good! Previously, some icons used to be in the themes right? https://github.com/jupyterlab/jupyterlab/blob/master/packages/theme-light-extension/style/urls.css#L6