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

added notes about JLIcon's design to README #7782

Closed

Conversation

telamonian
Copy link
Member

References

#7299, #7700, #7767

There's been a lot of recent discussion about JLIcon. In order to help clarify things, I've added some notes about the design of JLIcon to the README of ui-components.

Code changes

None

User-facing changes

None

Backwards-incompatible changes

None

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@jtpio
Copy link
Member

jtpio commented Jan 14, 2020

This should also fix #7142?

- every icon can create a DOM node
- every icon can create a React component
- dynamic lookup (for when absolutely needed)
- Use dynamic lookup for the few cases in which an icon can only be specified as a string (such as in json schema files)
Copy link
Contributor

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'?

Copy link
Member Author

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 be my), I agree that your namespacing suggestion is the best practice going forward.

I see two issues (all dependent on the current implementation of JLIcon):

  1. Purely to provide a shim for backwards compatibility, the names foo-bar and jp-fooBarIcon are considered equivalent. This is due to the prevalence of jp-fooBarIcon style icon class names in current codebase (both core and extensions). How to implement both this shim and namespacing?

  2. 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.

@telamonian
Copy link
Member Author

@jtpio These particular docs probably aren't going to be of much interest/use to extension devs (mostly just notes on the conceptual design of JLIcon). I am also working on some dev docs, though

Co-Authored-By: Jeremy Tuloup <jeremy.tuloup@gmail.com>
- need to deprecate, then later remove, `iconClass` from a number of interfaces
- replacable
- all icons can be customized by replacing their svg dynamically during runtime
- currently, I'm leaning towards the idea that icon replacements should be an (optional) part of a theme
Copy link
Member

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

@saulshanabrook
Copy link
Member

Thanks for these notes! This all looks good to me!

@blink1073
Copy link
Member

This work was merged into #7767

@blink1073 blink1073 closed this Jan 30, 2020
@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 29, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg:ui-components status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants