MCPcopy Create free account
hub / github.com/microsoft/SandDance / FontIcon

Function FontIcon

docs/app/js/sanddance-app.js:29038–29068  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

29036 };
29037}, undefined, true);
29038var FontIcon = function(props) {
29039 var iconName = props.iconName, className = props.className, _a = props.style, style = _a === void 0 ? {} : _a;
29040 var iconContent = getIconContent(iconName) || {};
29041 var iconClassName = iconContent.iconClassName, children = iconContent.children, fontFamily = iconContent.fontFamily, mergeImageProps = iconContent.mergeImageProps;
29042 var nativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.htmlElementProperties));
29043 var accessibleName = props["aria-label"] || props.title;
29044 var containerProps = props["aria-label"] || props["aria-labelledby"] || props.title ? {
29045 role: mergeImageProps ? undefined : "img"
29046 } : {
29047 "aria-hidden": true
29048 };
29049 var finalChildren = children;
29050 if (mergeImageProps) {
29051 if (typeof children === "object" && typeof children.props === "object" && accessibleName) finalChildren = _react.cloneElement(children, {
29052 alt: accessibleName
29053 });
29054 }
29055 return _react.createElement("i", (0, _tslib.__assign)({
29056 "data-icon-name": iconName
29057 }, containerProps, nativeProps, mergeImageProps ? {
29058 title: undefined,
29059 "aria-label": undefined
29060 } : {}, {
29061 className: (0, _utilities.css)((0, _iconStyles.MS_ICON), (0, _iconStyles.classNames).root, iconClassName, !iconName && (0, _iconStyles.classNames).placeholder, className),
29062 // Apply the font family this way to ensure it doesn't get overridden by Fabric Core ms-Icon styles
29063 // https://github.com/microsoft/fluentui/issues/10449
29064 style: (0, _tslib.__assign)({
29065 fontFamily: fontFamily
29066 }, style)
29067 }), finalChildren);
29068};
29069var getFontIcon = (0, _utilities.memoizeFunction)(function(iconName, className, ariaLabel) {
29070 return FontIcon({
29071 iconName: iconName,

Callers 1

sanddance-app.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected