feat(ui): rebuild Alchemy Alert layout, add actionPlacement, errorMessage, and Storybook#17746
feat(ui): rebuild Alchemy Alert layout, add actionPlacement, errorMessage, and Storybook#17746annadoesdesign wants to merge 1 commit into
Conversation
…sage, and Storybook
Restructures the Alchemy Alert into a column layout: a header row with the
icon + title on the left and an optional topRight action + close button on the
right, followed by a body section that spans the full container width for
description, errorMessage, and inline actions. Previously the description's
width was constrained by whatever sat on the right side of the alert.
Adds:
- `actionPlacement` prop ('inline' | 'topRight') so consumers can put an
action button next to the close X without sacrificing description width.
- `errorMessage` prop for technical error detail rendered in a monospace
block beneath the description.
- `unknown` variant (neutral surface + Question icon) for indeterminate
states.
- `VARIANT_BUTTON_COLOR_MAP` so any in-Alert button (close X, action) reads
as the same hue as the surrounding banner.
- `data-testid` forwarding to the container for test selectors.
- Storybook coverage with a sandbox plus dedicated stories for variants,
dismissible, withAction, withErrorMessage, topRightAction, customIcon,
and kitchenSink.
Layout polish:
- Body content (description, errorMessage, inline action) is indented 28px
(icon width + header gap) so it aligns flush with the title text.
- AlertActions wrapper is pulled left by 12px so the inline button label
sits flush with the description without losing the button's hit-target
padding.
- Description bumped from 12px to 14px to match the title size.
- AlertBody pulls -4px to tighten the title -> description leading.
Side fix:
- Button.tsx imports Icon via the specific path
(@components/components/Icon) instead of the barrel (@components) to
break a circular dependency triggered when Alert started importing
Button.
Public API is fully backward compatible -- existing consumers (variant +
title only, plus optional description / icon / action / onClose / className /
style) continue to work without changes.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
🔴 Meticulous spotted visual differences in 21 of 1442 screens tested: view and approve differences detected. Meticulous evaluated ~10 hours of user flows against your PR. Last updated for commit |
Bundle ReportChanges will increase total bundle size by 827 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: datahub-react-web-esmAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| backgroundColor: theme.colors.bg, | ||
| borderRadius: radius.md, | ||
| padding: `${spacing.xxsm} ${spacing.xsm}`, | ||
| fontFamily: "'SF Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace", |
There was a problem hiding this comment.
Shouldn't we use typography.fonts.mono from @components/theme?
Summary
Rebuilds the Alchemy
Alertcomponent into a column layout where thedescription and other body content span the full container width, independent
of what's on the right side of the header. Previously the description was
constrained by whatever sat to its right (close button + any actions), which
caused awkward wrapping for longer text.
Also adds several capabilities to bring the OSS Alert in line with how it's
already being used downstream, plus first-time Storybook coverage.
New layout
topRightaction + close X on the right.errorMessage, inline action) is indented 28px so it aligns flush with the title text rather than the icon's left edge.New props / variants
actionPlacement?: 'inline' | 'topRight'— where to render the optionalactionelement. Defaults to'inline'(under the description).'topRight'places it next to the close X without sacrificing description width.errorMessage?: string— technical error detail rendered in a monospace block beneath the description.unknownvariant — neutral surface + Question icon for indeterminate states.data-testidis now forwarded to the container so test selectors work.Polish
VARIANT_BUTTON_COLOR_MAP(close X reads as the same hue as the banner).AlertActionsis pulled left by 12px so the inline button label sits flush with the description while the button itself keeps its normal hit-target padding.AlertBodypulls-4pxto tighten the title → description leading.Side fix
Button.tsxnow importsIconvia the specific path(
@components/components/Icon) instead of the barrel (@components). Thisbreaks a circular-dependency chain (
Alert→Button→@components→FileDragAndDropArea→styled(Button)) that previously causedCannot create styled-component for component: undefinedduring testing.Backward compatibility
Public API is fully additive — every existing prop (
variant,title,description,icon,action,onClose,className,style) keeps thesame behavior. No consumer changes required.
Storybook
First-time Storybook coverage for
Alert:sandbox(interactive playground with toggles for every prop, includingactionPlacement)variants,dismissible,withAction,topRightAction,withErrorMessage,customIcon,titleOnly,kitchenSinkChecklist
feat(ui): …)Alert.test.tsx, including new coverage forerrorMessagerendering,unknownvariant, andactionPlacement="topRight")Alert.stories.tsx)Test plan
tsc --noEmit -p .cleaneslintclean (only the pre-existingreact-refresh/only-export-componentswarning, consistent with the existingButton.tsxbuttonDefaultsco-export pattern)vitest run Alert.test.tsx— 16/16 passprettier --checkclean on all touched filesyarn storybook)Made with Cursor