feat(alert): add alert atom#260
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Alert atom to the design system, providing semantic status styling, optional dismiss behavior (controlled/uncontrolled), and accompanying Storybook + unit test coverage. It fits into the atoms layer and is exported from the package entrypoint for consumption by downstream apps.
Changes:
- Added
Alertatom implementation (Alert.tsx) driven by a dedicated state/behavior hook (useAlert.ts) and CVA variants (types.ts). - Added comprehensive unit tests covering a11y wiring, controlled/uncontrolled dismissal, and reduced-motion behavior.
- Added Storybook stories demonstrating defaults, variants, controlled/uncontrolled usage, and rich content cases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Exports the new Alert atom from the package entrypoint. |
| src/components/atoms/alert/Alert.tsx | Renders the Alert structure (icon/title/description/end-content/close button) using useAlert. |
| src/components/atoms/alert/useAlert.ts | Implements controlled/uncontrolled open state, reduced-motion handling, ARIA ids, and class composition. |
| src/components/atoms/alert/types.ts | Defines Alert variants (CVA), public props, and default icon mapping per semantic color. |
| src/components/atoms/alert/index.ts | Barrel export for Alert and its types. |
| src/components/atoms/alert/Alert.test.tsx | Validates behavior + accessibility wiring with Testing Library/Vitest. |
| src/components/atoms/alert/Alert.stories.tsx | Documents usage/variants and showcases edge cases in Storybook. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Alert atom component with semantic statuses, dismissible behavior, and Storybook/test coverage.
Closes #13
Review scope
src/components/atoms/alert/*src/index.tsType of change
Workflow gates
Closes #NNNor maintainer approved an exception.status:approvedbefore implementation starts.In progress, branch/worktree recorded.<type>(<optional scope>): <description>..playwright-mcp,page-*.png,page-*.jpeg,*.md.playwright-output.Component evidence (required for component changes)
types.ts,use*.ts,Component.tsx,Component.test.tsx,Component.stories.tsx,index.ts.types.ts; JSX component has no state, CVA calls, or business logic.@defaultJSDoc intypes.ts(node scripts/verify-prop-default-docs.mjs).theme.css; no hardcoded colors or arbitrary color utilities.Accessibility evidence
Validation evidence
pnpm build✅pnpm test src/components/atoms/alert/Alert.test.tsx✅ — 20/20pnpm test✅ — 33 files, 628 testspnpm build✅pnpm storybook-build✅role="alert", conditionalaria-labelledby/aria-describedby, dismiss label, keyboard dismissal, reduced motion, and focus behavior ✅Screenshots or recordings
Manual Storybook visual checks were performed for default, semantic, rich content, long content, custom color, and title-only dismissible states.
Final title-only measurement:
56px36x36px14x14px89pxNotes for reviewer
variant="solid"andcolor="primary";primaryintentionally uses the neutral/default visual treatment.primary,success,warning, anddanger;secondaryis intentionally not exposed.solid,bordered, andflat;fadedwas removed because it duplicatedsolidvisually.subtitleandchildrenacceptReactNode, including rich inline content.