UNPKG

1.32 kBSource Map (JSON)View Raw
1{"version":3,"file":"getIconClassName.js","sourceRoot":"../src/","sources":["utilities/getIconClassName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAU,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,IAAM,iBAAiB,GAAW;IAChC,OAAO,EAAE,cAAc;CACxB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,IAAI,IAAI,EAAE;QACR,SAAS,GAAG,WAAW,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","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