Skip to content

Commit 6f59d6e

Browse files
fix: remove width/height attrs, add display:block for correct 16:10 cards
HTML width/height attributes on inline <img> elements override CSS aspectRatio, causing cards to be taller than wide. Fix: remove attrs and use display:block so CSS aspectRatio:'16/10' controls the uniform card box size, matching original CardMedia behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bfcb29e commit 6f59d6e

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

app/src/components/ImageCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,8 @@ export const ImageCard = memo(function ImageCard({
164164
fetchPriority={index === 0 ? 'high' : undefined}
165165
src={getFallbackSrc(image.url)}
166166
alt={viewMode === 'library' ? `${image.spec_id} - ${image.library}` : `${selectedSpec} - ${image.library}`}
167-
width={800}
168-
height={500}
169167
sx={{
168+
display: 'block',
170169
width: '100%',
171170
aspectRatio: '16 / 10',
172171
objectFit: 'contain',

app/src/components/SpecDetailView.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ export function SpecDetailView({
105105
src={`${currentImpl.preview_url.replace(/\.png$/, '')}_1200.png`}
106106
alt={`${specTitle} - ${selectedLibrary}`}
107107
onLoad={onImageLoad}
108-
width={1200}
109-
height={750}
110108
sx={{
109+
display: 'block',
111110
width: '100%',
112111
height: '100%',
113112
objectFit: 'contain',

app/src/components/SpecOverview.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ function ImplementationCard({
158158
component="img"
159159
src={`${impl.preview_url.replace(/\.png$/, '')}_800.png`}
160160
alt={`${specTitle} - ${impl.library_id}`}
161-
width={800}
162-
height={500}
163161
sx={{
162+
display: 'block',
164163
width: '100%',
165164
aspectRatio: '16/10',
166165
objectFit: 'contain',

app/src/pages/CatalogPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,8 @@ export function CatalogPage() {
264264
component="img"
265265
src={getFallbackSrc(currentImage.url)}
266266
alt={spec.title}
267-
width={800}
268-
height={500}
269267
sx={{
268+
display: 'block',
270269
width: '100%',
271270
height: '100%',
272271
objectFit: 'cover',

0 commit comments

Comments
 (0)