UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

19 lines (18 loc) 1.03 kB
import { __assign, __rest } from "tslib"; import clsx from 'clsx'; import React from 'react'; import { getBaseProps } from '../internal/base-component'; import styles from './styles.css.js'; import icons from './icons'; import { useTelemetry } from '../internal/hooks/use-telemetry'; export default function Icon(_a) { var name = _a.name, _b = _a.size, size = _b === void 0 ? 'normal' : _b, _c = _a.variant, variant = _c === void 0 ? 'normal' : _c, url = _a.url, alt = _a.alt, props = __rest(_a, ["name", "size", "variant", "url", "alt"]); useTelemetry('Icon'); var baseProps = getBaseProps(props); baseProps.className = clsx(baseProps.className, styles.icon, styles["size-" + size], styles["variant-" + variant]); if (url) { return (React.createElement("span", __assign({}, baseProps), React.createElement("img", { src: url, alt: alt }))); } return React.createElement("span", __assign({}, baseProps, { dangerouslySetInnerHTML: name ? { __html: icons[name] } : undefined })); }