Commit 69a75c1
committed
feat: add topOverlay support to SummaryCard with helper component
Add flexible image overlay system for displaying logos, badges, and custom content on top of SummaryCard images.
Features:
- `topOverlay` prop accepts any React.ReactNode for maximum flexibility
- `SummaryCard.Overlay` helper component with preset styles:
- Background presets: 'dark' | 'light' | 'transparent' | custom color
- Alignment options: 'left' | 'center' | 'right'
- Customizable height and padding
- Works with both single images and grid layouts
- Compatible with all card variants (default, flat) and sizes (default, compact)
- Proper z-index layering above images, below loading/error states
Implementation:
- Added `topOverlay?: React.ReactNode` prop to SummaryCardProps
- Created `SummaryCardOverlay` component with comprehensive props interface
- Added CSS for absolute positioning with proper border-radius matching
- Exported `SummaryCardOverlayProps` type from package index
Testing:
- Added 82 comprehensive tests (up from 79)
- New tests cover flat variant, compact size, and aspect ratio compatibility
- All overlay features fully tested (background, alignment, sizing)
Documentation:
- 8 Storybook examples demonstrating various use cases:
- Logo overlays with dark/light backgrounds
- Custom background colors
- Grid images with left-aligned badges
- Flat and compact variant examples
- Complete JSDoc with usage examples
- PropsTable updated with topOverlay documentation
Example usage:
```tsx
<SummaryCard
images="property.jpg"
title="Beach House"
topOverlay={
<SummaryCard.Overlay background="dark" height={40} align="center">
<img src="logo.png" alt="Company" style={{ height: 24 }} />
</SummaryCard.Overlay>
}
/>
```
Files changed:
- SummaryCard.tsx: Component implementation
- SummaryCard.module.css: Overlay positioning styles
- SummaryCard.stories.tsx: 8 comprehensive examples
- SummaryCard.test.tsx: 82 tests with variant coverage
- index.ts: Export SummaryCardOverlayProps type1 parent b1925cd commit 69a75c1
File tree
6 files changed
+800
-28
lines changed- packages/ui/src/components/Card
6 files changed
+800
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
0 commit comments