Skip to content

Commit

Permalink
Added optional className param to JIcon constructor
Browse files Browse the repository at this point in the history
Currently JIcons are initalized with a generated className based on
the name. This means all classNames are prepended with `jp-` but
this procludes the idea of extensions creating thier own JIcons
with project unique CSS selectors
  • Loading branch information
ajbozarth committed Jan 31, 2020
1 parent a72a98c commit e97a5ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ui-components/src/icon/jlicon.tsx
Expand Up @@ -117,9 +117,10 @@ export class JLIcon {
JLIcon._debug = debug ?? !JLIcon._debug;
}

constructor({ name, svgstr }: JLIcon.IOptions) {
constructor({ name, svgstr, className }: JLIcon.IOptions) {
this.name = name;
this._className = Private.nameToClassName(name);
this._className =
className != undefined ? className : Private.nameToClassName(name);
this.svgstr = svgstr;

this.react = this._initReact();
Expand Down Expand Up @@ -351,6 +352,7 @@ export namespace JLIcon {
export interface IOptions {
name: string;
svgstr: string;
className?: string;
}

/**
Expand Down

0 comments on commit e97a5ac

Please sign in to comment.