Add inline-simple alert variant#436
Conversation
| @@ -139,3 +139,70 @@ export const WithCustomIcon: Story = { | |||
| }, | |||
There was a problem hiding this comment.
What: Consider extracting Alert component properties into a variable to avoid repetition.
Why: This change improves maintainability and readability of the code. It also reduces the chances of inconsistent updates to the Alert properties in the future.
How: You can define a common object for the Alert properties and then spread it in the Alert component calls. For example:
const alertProps = {
title: 'Title',
content: 'Alert message will be here..',
onClose: fn(),
action: {
label: 'Action',
onClick: () => {},
type: 'link',
},
};
<Alert design="inline-simple" variant="neutral" {...alertProps} />
<Alert design="inline-simple" variant="info" {...alertProps} />
// and so on for other variants| @@ -139,3 +139,70 @@ export const WithCustomIcon: Story = { | |||
| }, | |||
There was a problem hiding this comment.
What: Use meaningful content placeholders instead of just 'Alert message will be here..'.
Why: Using more descriptive placeholders helps clarify intent and functionality to other developers who may later read this code. It can also assist in understanding the variant-specific functions/case for the Alert message.
How: Replace the content string with variant-specific messages, e.g., content="This is a neutral alert" for each variant.
| @@ -139,3 +139,70 @@ export const WithCustomIcon: Story = { | |||
| }, | |||
There was a problem hiding this comment.
What: Each Alert component appears to receive the same title and content, consider if this is the desired behavior.
Why: If different variants of alerts should convey different messages, keeping them the same may lead to confusion during usage. Clearly defined messages assist in distinguishing the alerts during notifications or UI presentation.
How: Review if the application logic requires these variants to share the same title and content; if not, assign varying text for titles and contents to each Alert according to their purpose.
5927001 to
4be19f0
Compare
Summary
inline-simplealert design to the Alert componentneutral,info,success,warning, anddangerWhat Changed
src/components/alert/alert.tsxto support a newdesign="inline-simple"rendering pathdangeras a supported alert variant and mapped it to the existing error token treatmentpx-3,py-3, andgap-2inlineandstackalert designs intactInlineSimpleVariantsstory insrc/components/alert/alert.stories.tsxto show neutral, info, success, warning, and danger statesNotes
Validation