diff --git a/packages/status-badge/src/Component.tsx b/packages/status-badge/src/Component.tsx index 35739daa54..a8e296a164 100644 --- a/packages/status-badge/src/Component.tsx +++ b/packages/status-badge/src/Component.tsx @@ -58,6 +58,15 @@ export type StatusBadgeProps = { * Идентификатор для систем автоматизированного тестирования */ dataTestId?: string; + + /** + * Необходим для переопределения иконок + */ + customIcons?: { + negative: React.FC>; + positive: React.FC>; + attention: React.FC>; + }; }; const ICON_MAP: Record< @@ -128,7 +137,23 @@ export const StatusBadge = ({ size = 24, view, colors = 'default', + customIcons, }: StatusBadgeProps) => { + if (customIcons) { + ICON_MAP['positive-checkmark'] = { + ...ICON_MAP['positive-checkmark'], + 24: customIcons.positive, + }; + ICON_MAP['negative-cross'] = { + ...ICON_MAP['negative-cross'], + 24: customIcons.negative, + }; + ICON_MAP['attention-alert'] = { + ...ICON_MAP['attention-alert'], + 24: customIcons.attention, + }; + } + const Icon = ICON_MAP[view][size]; return ( diff --git a/packages/toast-plate/src/components/base-toast-plate/component.tsx b/packages/toast-plate/src/components/base-toast-plate/component.tsx index d19e110844..4e139582fb 100644 --- a/packages/toast-plate/src/components/base-toast-plate/component.tsx +++ b/packages/toast-plate/src/components/base-toast-plate/component.tsx @@ -18,6 +18,12 @@ const colorStyles = { inverted: invertedColors, }; +export type BadgeIcons = { + negative: React.FC>; + positive: React.FC>; + attention: React.FC>; +}; + export type BaseToastPlateProps = HTMLAttributes & { /** * Дополнительный класс @@ -94,6 +100,11 @@ export type BaseToastPlateProps = HTMLAttributes & { */ onClose?: (event?: MouseEvent) => void; + /** + * Функция, с помощью которой можно переопределить иконки в Badge + */ + getBadgeIcons?: () => BadgeIcons; + /** * Набор цветов для компонента */ @@ -126,6 +137,7 @@ export const BaseToastPlate = forwardRef( actionButton, block, onClose, + getBadgeIcons, colors = 'default', closerWrapperClassName, closerClassName, @@ -175,6 +187,9 @@ export const BaseToastPlate = forwardRef( ))}