How Are The Toolbar Icons Generated?
Hello,
In the previous version of the OHIF Stand Alone Viewer I created custom icons for two new buttons for custom functionality. The way the icons are generated has changed significantly in the current version (0.2.1). In the current version, where are the icons stored and how are they built into the toolbar?
Thank you, Marc
In the monorepo version, the icons are located at \platform\ui\src\elements\Icon\icons To create a custom icon:
- store svg file in \platform\ui\src\elements\Icon\icons
- import icon file into \platform\ui\src\elements\Icon\getIcon.js
- add import to ICONS const in \platform\ui\src\elements\Icon\getIcon.js
- specify new icon to use for button in \extensions\cornerstone\src\toolbarModules.js
- restart app
FWIW, this works well if you don't mind maintaining a fork. A less conflict-prone solution could be updating the Toolbar module/config to allow the consumer to provide their own component to use in place of the Icon or ToolbarButton component. That component could be a simple React component that encapsulates an SVG.
That is something we plan on eventually supporting, and would be more than happy to review a PR for.