UNPKG

@i-novus/ui-core

Version:

Базовые UI компоненты

17 lines (16 loc) 763 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from 'react'; import classNames from 'classnames'; import { useConfigProvider } from '../core'; export const Icon = forwardRef((props, ref) => { const { className, visible = true, icon, iconPrefix: externalIconPrefix, style, ...rest } = props; const { iconPrefix } = useConfigProvider(); if (!visible) { return null; } const prefixCls = externalIconPrefix || iconPrefix; if (typeof icon === 'string') { return _jsx("i", { ...rest, className: classNames(prefixCls, `${prefixCls}-${icon}`, className), style: style }); } return (_jsx("span", { ...rest, ref: ref, className: classNames(prefixCls, className), style: style, children: icon })); });