UNPKG

1.25 kBSource Map (JSON)View Raw
1{"version":3,"file":"getIconClassName.js","sourceRoot":"../src/","sources":["utilities/getIconClassName.ts"],"names":[],"mappings":";;;IAGA,IAAM,iBAAiB,GAAW;QAChC,OAAO,EAAE,cAAc;KACxB,CAAC;IAEF;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,IAAY;QAC3C,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAM,IAAI,GAAG,eAAO,CAAC,IAAI,CAAC,CAAC;QAE3B,IAAI,IAAI,EAAE;YACR,SAAS,GAAG,0BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE;gBAChE,SAAS,EAAE;oBACT,UAAU,EAAE;wBACV,OAAO,EAAE,OAAI,IAAI,CAAC,IAAI,OAAG;qBAC1B;iBACF;aACF,CAAC,CAAC;SACJ;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAfD,4CAeC","sourcesContent":["import { mergeStyles, IStyle } from '@uifabric/merge-styles';\nimport { getIcon } from './icons';\n\nconst defaultIconStyles: IStyle = {\n display: 'inline-block',\n};\n\n/**\n * Gets an icon classname. You should be able to add this classname to an I tag with no\n * additional classnames, and render the icon.\n *\n * @public\n */\nexport function getIconClassName(name: string): string {\n let className = '';\n const icon = getIcon(name);\n\n if (icon) {\n className = mergeStyles(icon.subset.className, defaultIconStyles, {\n selectors: {\n '::before': {\n content: `\"${icon.code}\"`,\n },\n },\n });\n }\n\n return className;\n}\n"]}
\No newline at end of file