@@ -160,10 +160,48 @@ const componentIllustrations: Record<string, React.ComponentType | undefined> =
160160 'usePress' : usePressSvg
161161} ;
162162
163- const illustrationStyles = style ( {
163+ // Overrides for specific illustrations so they fit within the cards.
164+ const propOverrides = {
165+ DateField : {
166+ viewBox : '0 -56 276 276'
167+ } ,
168+ TimeField : {
169+ viewBox : '0 -56 276 276'
170+ } ,
171+ DatePicker : {
172+ style : { alignSelf : 'end' , height : 'calc(100% - 16px)' }
173+ } ,
174+ DateRangePicker : {
175+ style : { alignSelf : 'end' , height : 'calc(100% - 16px)' }
176+ } ,
177+ DropZone : {
178+ viewBox : '0 0 290 220' ,
179+ style : { height : 'calc(100% - 16px)' }
180+ } ,
181+ Select : {
182+ // Safari doesn't calculate the max-height correctly with the aspect-ratio.
183+ style : { height : 'calc(100% - 16px)' }
184+ } ,
185+ Picker : {
186+ style : { height : 'calc(100% - 16px)' }
187+ } ,
188+ ComboBox : {
189+ style : { height : 'calc(100% - 16px)' }
190+ }
191+ } ;
192+
193+ const illustrationContainer = style ( {
164194 width : 'full' ,
165195 aspectRatio : '3/2' ,
166- objectFit : 'cover' ,
196+ backgroundColor : '--anatomy-gray-100' ,
197+ display : 'flex' ,
198+ alignItems : 'center' ,
199+ justifyContent : 'center' ,
200+ minHeight : 0
201+ } ) ;
202+
203+ const illustrationStyles = style ( {
204+ maxWidth : 'calc(100% - 16px)' ,
167205 userSelect : 'none' ,
168206 pointerEvents : 'none'
169207} ) ;
@@ -183,13 +221,21 @@ export function ComponentCardView({items, ariaLabel = 'Items', size = 'S', onAct
183221 < Collection items = { items } >
184222 { ( item ) => {
185223 let IllustrationComponent = componentIllustrations [ item . name ] || ComingSoonSvg ;
224+ let overrides = propOverrides [ item . name ] || { } ;
186225 return (
187226 < Card key = { item . id } id = { item . id } href = { item . href } size = { size } textValue = { item . name } >
188227 < CardPreview >
189- < IllustrationComponent
190- aria-hidden = "true"
191- // @ts -ignore
192- className = { illustrationStyles } />
228+ < div className = { illustrationContainer } >
229+ < IllustrationComponent
230+ { ...overrides }
231+ aria-hidden = "true"
232+ // @ts -ignore
233+ className = { illustrationStyles }
234+ style = { {
235+ maxHeight : 'calc(100% - 16px)' ,
236+ ...overrides . style
237+ } } />
238+ </ div >
193239 </ CardPreview >
194240 < Content >
195241 < Text slot = "title" > { item . name } </ Text >
0 commit comments