UNPKG

1.27 kBSource Map (JSON)View Raw
1{"version":3,"file":"getIconClassName.js","sourceRoot":"../src/","sources":["utilities/getIconClassName.ts"],"names":[],"mappings":";;AAAA,uDAA6D;AAC7D,iCAAkC;AAElC,IAAM,iBAAiB,GAAW;IAChC,OAAO,EAAE,cAAc;CACxB,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAM,IAAI,GAAG,eAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,IAAI,IAAI,EAAE;QACR,SAAS,GAAG,0BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE;YAChE,SAAS,EAAE;gBACT,UAAU,EAAE;oBACV,OAAO,EAAE,OAAI,IAAI,CAAC,IAAI,OAAG;iBAC1B;aACF;SACF,CAAC,CAAC;KACJ;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,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