Support Non-Nimble icons in the Nimble table#2813
Conversation
...ges/nimble-components/src/mapping/icon/specs/nimble-table-column-mapping-custom-icons-hld.md
Outdated
Show resolved
Hide resolved
packages/ok-components/src/mapping/custom-image/specs/table-column-mapping-custom-icons-hld.md
Outdated
Show resolved
Hide resolved
# Pull Request ## 🤨 Rationale Refactor the Icon base class so new types of icons can extend the class manually. Should be a non-breaking change for users as existing icon api and paths don't change. Intention is to support custom icon types such as multicolor icons (#327) and dynamic icons (#2813). ## 👩💻 Implementation - Refactor the Icon base class to be abstract - Make a new SVGIcon base class that implements the current infrastructure for nimble icons ## 🧪 Testing - Rely on existing tests ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: rajsite <1588923+rajsite@users.noreply.github.com>
| // <ok-dynamic-icon-rumham></ok-dynamic-icon-rumham> | ||
| ``` | ||
|
|
||
| #### Blazor Integration |
There was a problem hiding this comment.
Talking with @jattasNI put together a more end-to-end prototype that I think shows the pattern more clearly. Instead of having a declarative icon registration and renderer at the same time we will split the registration and rendering into separate parts.
Registration will be a programmatic API call from C#, i.e. a function like RegisterIconDynamicAsync. With the registration complete you have all the pieces you need to render in a table. The PoC PR #2827 shows what calling a registration from C# looks like and how it is used in the table. To take the PoC over the finish line we should move the JSInvoke calls from the example app and into the OkBlazor library. I added some comments about where they should go. In the example we have a helper JS Component with a static method for registering I think we should have a similar helper Blazor Component with a static method for registering. We'd then also want tests in the component, blazor, and storybook docs to finish up.
As a follow-on if you want to use the icons in spots outside the table we can add an addtional helper component to render the icon like <OkIconViewer Icon="ok-dynamic-icon-awesome"></OkIconViewer>. That's only if you also want to render dynamic icons in buttons, dropdowns, etc (the PoC branch linked does not demonstrate the Viewer but my understanding is for today you just need the Table support). The pattern suggested here is to align with the table mapping icon:
<NimbleMappingIcon Icon="ok-dynamic-icon-awesome"></NimbleMappingIcon>
<OkIconViewer Icon="ok-dynamic-icon-awesome"></OkIconViewer>If the above sounds good and you want to take the PoC branch over the finish line with the above suggestions then we have enough detail captured here to avoid needing the complete HLD.
Pull Request
🤨 Rationale
Clients need a way to display non-nimble icons, specifically SVG and PNG, in a Nimble table. This HLD proposes adding additional mappings for an SVG and PNG so they can be displayed.
👩💻 Implementation
N/A
🧪 Testing
N/A
✅ Checklist