@@ -8,6 +8,7 @@ import { Icon } from '../Icon';
88import type { IconName } from '../../tokens/icons' ;
99import { Skeleton } from '../Skeleton' ;
1010import { Alert } from '../Alert' ;
11+ import { Overlay , type OverlayProps } from '../Overlay' ;
1112import styles from './SummaryCard.module.css' ;
1213
1314export interface SummaryCardImage {
@@ -278,103 +279,9 @@ const normalizeImage = (image: string | SummaryCardImage): SummaryCardImage => {
278279
279280/**
280281 * Props for SummaryCard.Overlay helper component
282+ * @deprecated Use OverlayProps from shared Overlay component
281283 */
282- export interface SummaryCardOverlayProps {
283- /**
284- * Background style for the overlay
285- * - "dark": Semi-transparent dark background (rgba(0, 0, 0, 0.6))
286- * - "light": Semi-transparent light background (rgba(255, 255, 255, 0.8))
287- * - "transparent": No background
288- * - Custom string: Any valid CSS color value
289- * @default "dark"
290- */
291- background ?: 'dark' | 'light' | 'transparent' | string ;
292-
293- /**
294- * Height of the overlay
295- * @default 40
296- */
297- height ?: number | string ;
298-
299- /**
300- * Horizontal alignment of content
301- * @default "center"
302- */
303- align ?: 'left' | 'center' | 'right' ;
304-
305- /**
306- * Padding inside the overlay
307- * @default 8
308- */
309- padding ?: number ;
310-
311- /**
312- * Content to render inside the overlay
313- */
314- children : React . ReactNode ;
315-
316- /**
317- * Additional CSS class name
318- */
319- className ?: string ;
320- }
321-
322- /**
323- * Helper component for creating consistently styled overlays on SummaryCard images
324- *
325- * @example
326- * ```tsx
327- * <SummaryCard
328- * images="property.jpg"
329- * topOverlay={
330- * <SummaryCard.Overlay background="dark" height={40} align="center">
331- * <img src="logo.png" alt="Logo" style={{ height: 24 }} />
332- * </SummaryCard.Overlay>
333- * }
334- * />
335- * ```
336- */
337- const SummaryCardOverlay = React . forwardRef < HTMLDivElement , SummaryCardOverlayProps > (
338- (
339- { background = 'dark' , height = 40 , align = 'center' , padding = 8 , children, className } ,
340- ref
341- ) => {
342- // Map background presets to CSS values
343- const backgroundMap : Record < string , string > = {
344- dark : 'rgba(0, 0, 0, 0.6)' ,
345- light : 'rgba(255, 255, 255, 0.8)' ,
346- transparent : 'transparent' ,
347- } ;
348-
349- const backgroundValue = backgroundMap [ background ] || background ;
350-
351- // Map align to justify-content values
352- const justifyContentMap : Record < string , string > = {
353- left : 'flex-start' ,
354- center : 'center' ,
355- right : 'flex-end' ,
356- } ;
357-
358- const justifyContent = justifyContentMap [ align ] || 'center' ;
359-
360- return (
361- < div
362- ref = { ref }
363- className = { cn ( styles . topOverlay , className ) }
364- style = { {
365- background : backgroundValue ,
366- height : typeof height === 'number' ? `${ height } px` : height ,
367- justifyContent,
368- padding : `${ padding } px` ,
369- } }
370- >
371- { children }
372- </ div >
373- ) ;
374- }
375- ) ;
376-
377- SummaryCardOverlay . displayName = 'SummaryCard.Overlay' ;
284+ export type SummaryCardOverlayProps = OverlayProps ;
378285
379286/**
380287 * SummaryCard component for displaying entity information with images.
@@ -876,8 +783,8 @@ SummaryCardComponent.displayName = 'SummaryCard';
876783
877784// Create typed SummaryCard with Overlay subcomponent
878785export const SummaryCard = SummaryCardComponent as typeof SummaryCardComponent & {
879- Overlay : typeof SummaryCardOverlay ;
786+ Overlay : typeof Overlay ;
880787} ;
881788
882- // Attach Overlay component to SummaryCard
883- SummaryCard . Overlay = SummaryCardOverlay ;
789+ // Attach shared Overlay component to SummaryCard
790+ SummaryCard . Overlay = Overlay ;
0 commit comments