Skip to content

Commit 69a75c1

Browse files
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 type
1 parent b1925cd commit 69a75c1

File tree

6 files changed

+800
-28
lines changed

6 files changed

+800
-28
lines changed

packages/ui/src/components/Card/SummaryCard.module.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,21 @@
371371
white-space: nowrap;
372372
border: 0;
373373
}
374+
375+
/* Top Overlay */
376+
.topOverlay {
377+
position: absolute;
378+
top: 0;
379+
left: 0;
380+
right: 0;
381+
display: flex;
382+
align-items: center;
383+
z-index: 1; /* Above image, below loading/error states */
384+
border-radius: 16px 16px 0 0; /* Match image top corners */
385+
pointer-events: auto; /* Allow interaction if needed */
386+
}
387+
388+
/* Image Section - Make it position relative for absolute overlay positioning */
389+
.imageSection {
390+
position: relative;
391+
}

packages/ui/src/components/Card/SummaryCard.module.css.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ declare const styles: {
2525
readonly emptyState: string;
2626
readonly emptyTitle: string;
2727
readonly emptyMessage: string;
28+
readonly topOverlay: string;
2829
};
2930

3031
export default styles;

0 commit comments

Comments
 (0)