• Robert Knight's avatar
    Separate out icon definitions from `SvgIcon` component · 67a51874
    Robert Knight authored
    Replace the hardcoded set of available icons in `svg-icon.js` with a
    `registerIcons` function which is called by the application at startup
    to register the icons that should be available for use.
    
    This will enable us to re-use the `SvgIcon` component in the "annotator"
    part of the client or other applications (as part of our UI component
    library) which use a different set of icons.
    
    The lms application currently has a different solution for this in its
    `SvgIcon` implementation which requires the icon markup to be passed
    each time the component is used. On reflection, I think that passing
    just the name at the point of use is going to be more convenient in app
    code and when writing tests.  It also avoids the need to validate the
    markup is from a trusted source on each use.
    67a51874
index.js 12.1 KB