@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
47 lines (46 loc) • 1.36 kB
JavaScript
"use client";
import React, { useContext } from 'react';
import Context from "../../shared/Context.js";
import { extendPropsWithContext } from "../../shared/component-helper.js";
import { prerenderIcon, prepareIcon } from "../icon/Icon.js";
import * as primary_icons from "../../icons/dnb/primary_icons.js";
import * as primary_icons_medium from "../../icons/dnb/primary_icons_medium.js";
import withComponentMarkers from "../../shared/helpers/withComponentMarkers.js";
import { jsx as _jsx } from "react/jsx-runtime";
export * from "../icon/Icon.js";
const icons = {
...primary_icons,
...primary_icons_medium
};
export default function IconPrimary(localProps) {
const context = useContext(Context);
const props = extendPropsWithContext(localProps, {}, {
skeleton: context === null || context === void 0 ? void 0 : context.skeleton
}, context.Icon, context.IconPrimary);
const {
icon,
size,
wrapperParams,
iconParams,
alt
} = prepareIcon(props, context);
const IconContainer = prerenderIcon({
icon,
size,
alt,
listOfIcons: icons
});
if (!IconContainer) {
return null;
}
return _jsx("span", {
...wrapperParams,
children: _jsx(IconContainer, {
...iconParams
})
});
}
withComponentMarkers(IconPrimary, {
_supportsSpacingProps: true
});
//# sourceMappingURL=IconPrimary.js.map