Skip to content

Commit

Permalink
Extract icon mapping into a variable outside the component
Browse files Browse the repository at this point in the history
  • Loading branch information
Made1ra committed Nov 27, 2024
1 parent 765a6ab commit f905a54
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/design-system/components/alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ const CloseButton = ({ label }: CloseButtonProps) => {
)
}

CloseButton.displayName = 'CloseButton'

const iconMapping = {
error: <ErrorOutline fontSize='inherit' />,
warning: <WarningAmberOutlined fontSize='inherit' />,
info: <InfoOutlined fontSize='inherit' />,
success: <CheckCircleOutline fontSize='inherit' />
}

interface AlertProps extends MuiAlertProps {
title?: string
description?: string
Expand Down Expand Up @@ -68,12 +77,7 @@ const Alert = forwardRef(
<MuiAlert
className={cn('s2s-alert', className)}
icon={icon}
iconMapping={{
error: <ErrorOutline fontSize='inherit' />,
warning: <WarningAmberOutlined fontSize='inherit' />,
info: <InfoOutlined fontSize='inherit' />,
success: <CheckCircleOutline fontSize='inherit' />
}}
iconMapping={iconMapping}
onClose={handleClose}
ref={forwardedRef}
slots={{
Expand Down

0 comments on commit f905a54

Please sign in to comment.