Skip to content

Commit 0bce46a

Browse files
fix: remove aspectRatio/sizing from picture wrapper to fix card layout
The <picture> element as a block container with aspectRatio doubled up with the inner <img> aspectRatio, causing oversized cards. Fix: use display:contents or minimal wrapper so <img> controls the layout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f4d6f93 commit 0bce46a

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

app/src/components/ImageCard.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,7 @@ export const ImageCard = memo(function ImageCard({
147147
},
148148
}}
149149
>
150-
<Box
151-
component="picture"
152-
sx={{
153-
display: 'block',
154-
width: '100%',
155-
aspectRatio: '16 / 10',
156-
bgcolor: '#fff',
157-
}}
158-
>
150+
<Box component="picture">
159151
<source
160152
type="image/webp"
161153
srcSet={buildSrcSet(image.url, 'webp')}
@@ -178,6 +170,7 @@ export const ImageCard = memo(function ImageCard({
178170
width: '100%',
179171
aspectRatio: '16 / 10',
180172
objectFit: 'contain',
173+
bgcolor: '#fff',
181174
}}
182175
onError={(e: React.SyntheticEvent<HTMLImageElement>) => {
183176
const target = e.target as HTMLImageElement;

app/src/components/SpecDetailView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ export function SpecDetailView({
8787
<Box
8888
component="picture"
8989
sx={{
90-
width: '100%',
91-
height: '100%',
92-
display: imageLoaded ? 'block' : 'none',
90+
display: imageLoaded ? 'contents' : 'none',
9391
}}
9492
>
9593
<source

app/src/components/SpecOverview.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,7 @@ function ImplementationCard({
143143
}}
144144
>
145145
{impl.preview_url ? (
146-
<Box
147-
component="picture"
148-
sx={{
149-
display: 'block',
150-
width: '100%',
151-
aspectRatio: '16/10',
152-
bgcolor: '#fff',
153-
}}
154-
>
146+
<Box component="picture">
155147
<source
156148
type="image/webp"
157149
srcSet={buildSrcSet(impl.preview_url, 'webp')}
@@ -172,6 +164,7 @@ function ImplementationCard({
172164
width: '100%',
173165
aspectRatio: '16/10',
174166
objectFit: 'contain',
167+
bgcolor: '#fff',
175168
}}
176169
onError={(e: React.SyntheticEvent<HTMLImageElement>) => {
177170
const target = e.target as HTMLImageElement;

app/src/pages/CatalogPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export function CatalogPage() {
248248
{currentImage && (
249249
<Box
250250
component="picture"
251-
sx={{ display: 'block', width: '100%', height: '100%' }}
251+
sx={{ display: 'contents' }}
252252
>
253253
<source
254254
type="image/webp"

0 commit comments

Comments
 (0)