Skip to content

Commit

Permalink
feat(Alert): added ability to pass null as icon prop value
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaevAlexandr committed Mar 6, 2024
1 parent 8a57f91 commit 78422eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export const Alert = (props: AlertProps) => {
qa={qa}
>
<Flex gap="3" alignItems={align}>
{props.icon || <Alert.Icon theme={theme} view={view} />}
{typeof props.icon === 'undefined' ? (
<Alert.Icon theme={theme} view={view} />
) : (
props.icon // ability to pass `null` as `icon` prop value
)}
<Flex direction={layout === 'vertical' ? 'column' : 'row'} gap="5" grow>
<Flex gap="2" grow className={bAlert('text-content')}>
<Flex direction="column" gap="1" grow justifyContent={align}>
Expand Down
7 changes: 7 additions & 0 deletions src/components/Alert/__stories__/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ const stories: AlertProps[] = [
theme: 'utility',
view: 'filled',
},
{
title,
message,
icon: null,
theme: 'utility',
view: 'filled',
},
{
message,
theme: 'normal',
Expand Down

0 comments on commit 78422eb

Please sign in to comment.