import React, { memo, forwardRef } from 'react'; import { useToken, usePropsResolution } from '../../../hooks'; import { makeStyledComponent } from '../../../utils/styled'; import { Svg, G } from './nbSvg'; import type { IIconProps } from './types'; import { questionOutlineIconPath } from './Icons/questionIconPath'; const SVG = makeStyledComponent(Svg); const SVGIcon = ({ children, ...props }: IIconProps, ref: any) => { const { focusable, stroke, color, size, ...resolvedProps } = usePropsResolution('Icon', props); const strokeHex = useToken('colors', stroke || ''); const colorHex = useToken('colors', color || ''); return ( {React.Children.count(children) > 0 ? ( {React.Children.map(children, (child, i) => ( ))} ) : ( questionOutlineIconPath )} ); }; const ChildPath = ({ element, fill, stroke: pathStroke }: any) => { const pathStrokeColor = useToken('colors', pathStroke || ''); const fillColor = useToken('colors', fill || ''); if (!element) { return null; } return React.cloneElement(element, { fill: fillColor ? fillColor : 'currentColor', stroke: pathStrokeColor, }); }; export default memo(forwardRef(SVGIcon));