2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 13:47:49 +00:00

Merge remote-tracking branch 'stephenwade/patch-1' into next

This commit is contained in:
Vjacheslav Trushkin 2024-07-25 18:24:26 +03:00
commit ad3ffb793f

View File

@ -1,4 +1,4 @@
import { forwardRef, createElement, type Ref } from 'react'; import { forwardRef, createElement, memo, type Ref } from 'react';
import type { IconifyIcon, IconifyJSON } from '@iconify/types'; import type { IconifyIcon, IconifyJSON } from '@iconify/types';
import type { IconifyIconSize } from '@iconify/utils/lib/customisations/defaults'; import type { IconifyIconSize } from '@iconify/utils/lib/customisations/defaults';
import { defaultIconProps } from '@iconify/utils/lib/icon/defaults'; import { defaultIconProps } from '@iconify/utils/lib/icon/defaults';
@ -63,25 +63,25 @@ type IconComponentType = (props: IconProps) => JSX.Element;
* *
* @param props - Component properties * @param props - Component properties
*/ */
export const Icon = forwardRef<IconElement, IconProps>((props, ref) => export const Icon = memo(forwardRef<IconElement, IconProps>((props, ref) =>
IconComponent({ IconComponent({
...props, ...props,
_ref: ref, _ref: ref,
}) })
) as IconComponentType; )) as IconComponentType;
/** /**
* Inline icon (has negative verticalAlign that makes it behave like icon font) * Inline icon (has negative verticalAlign that makes it behave like icon font)
* *
* @param props - Component properties * @param props - Component properties
*/ */
export const InlineIcon = forwardRef<IconElement, IconProps>((props, ref) => export const InlineIcon = memo(forwardRef<IconElement, IconProps>((props, ref) =>
IconComponent({ IconComponent({
inline: true, inline: true,
...props, ...props,
_ref: ref, _ref: ref,
}) })
) as IconComponentType; )) as IconComponentType;
/** /**
* Add icon to storage, allowing to call it by name * Add icon to storage, allowing to call it by name