How Are The Toolbar Icons Generated?

37 views
Skip to first unread message

Marc

unread,
Aug 16, 2019, 9:45:16 AM8/16/19
to cornerstone platform
Hello,

In the previous version of the OHIF Stand Alone Viewer I had created custom icons for two buttons for custom functionality. The way the icons are generated have changed significantly in the current version. In the current version (0.2.1), where are the icons stored and how are they built into the toolbar?

Thank you,
Marc

Marc

unread,
Aug 20, 2019, 1:33:03 PM8/20/19
to cornerstone platform

In the monorepo version, the icons are located at \platform\ui\src\elements\Icon\icons
To create a custom icon:

  1. store svg file in \platform\ui\src\elements\Icon\icons
  2. import icon file into \platform\ui\src\elements\Icon\getIcon.js
  3. add import to ICONS const in \platform\ui\src\elements\Icon\getIcon.js
  4. specify new icon to use for button in \extensions\cornerstone\src\toolbarModules.js
  5. restart app

Danny Brown

unread,
Aug 30, 2019, 9:17:41 AM8/30/19
to cornerstone platform
FWIW, we intend to allow end users to supply a custom component or react wrapped icon in place of using an icon that exists in the UI project. Please feel free to PR this enhancement, or create an issue in the repo if you would like to but require guidance.
Reply all
Reply to author
Forward
0 new messages