@navinc/base-react-components
Version:
Nav's Pattern Library
33 lines (31 loc) • 1.61 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { styled } from 'styled-components';
import { iconsMap } from './icons/index.js';
// Icon used to use Suspense to lazy load icons. It was removed to fix storybook using TS. Since then, we've started
// exporting icons/index.ts's iconList from src/index.ts (this is used in nav-blocks), which eliminates the benefit of
// lazy loading until we setup tree-shaking
const BaseIcon = (_a) => {
var { name, size = '24' } = _a, props = __rest(_a, ["name", "size"]);
const IconComponent = iconsMap[name];
return IconComponent ? _jsx(IconComponent, Object.assign({ width: size, height: size, "data-testid": `icon:${name}` }, props)) : null;
};
/**
* @deprecated use the wayfinder icon from @navinc/base-react-components/wayfinder instead
Displays an icon from our icon library
Props:
- name: (string) the name of the icon
- color: (string hex value from theme) (OPTIONAL) defaults to the color of its parent.
**/
export const Icon = styled(BaseIcon).withConfig({ displayName: "brc-sc-Icon", componentId: "brc-sc-1w4dwnh" }) ``;
//# sourceMappingURL=icon.js.map